home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Alpha ƒ / Help / Tcl Commands < prev    next >
Text File  |  1995-12-28  |  173KB  |  4,117 lines

  1.  
  2.  
  3.  
  4.                     Tcl Built-In Commands
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NAME
  11.      Tcl - Summary of Tcl language syntax.
  12. _________________________________________________________________
  13.  
  14.  
  15. DESCRIPTION
  16.      The following rules define the syntax and semantics  of  the
  17.      Tcl language:
  18.  
  19.      [1]  A Tcl script is a string containing one  or  more  com-
  20.           mands.  Semi-colons and newlines are command separators
  21.           unless quoted as described below.  Close  brackets  are
  22.           command  terminators  during  command substitution (see
  23.           below) unless quoted.
  24.  
  25.      [2]  A command is evaluated in two steps.   First,  the  Tcl
  26.           interpreter  breaks the command into words and performs
  27.           substitutions as described below.  These  substitutions
  28.           are  performed  in  the same way for all commands.  The
  29.           first word is used to locate  a  command  procedure  to
  30.           carry  out  the  command,  then all of the words of the
  31.           command are passed to the command procedure.  The  com-
  32.           mand  procedure  is free to interpret each of its words
  33.           in any way it likes, such as an integer, variable name,
  34.           list,  or  Tcl  script.   Different  commands interpret
  35.           their words differently.
  36.  
  37.      [3]  Words of a command are separated by white space (except
  38.           for newlines, which are command separators).
  39.  
  40.      [4]  If the  first  character  of  a  word  is  double-quote
  41.           (``"'')  then  the  word  is  terminated  by  the  next
  42.           double-quote character.  If semi-colons,  close  brack-
  43.           ets,  or  white  space  characters (including newlines)
  44.           appear between the quotes  then  they  are  treated  as
  45.           ordinary  characters and included in the word.  Command
  46.           substitution, variable substitution, and backslash sub-
  47.           stitution  are  performed on the characters between the
  48.           quotes as described below.  The double-quotes  are  not
  49.           retained as part of the word.
  50.  
  51.      [5]  If the first character of  a  word  is  an  open  brace
  52.           (``{'')  then  the  word  is terminated by the matching
  53.           close brace (``}'').  Braces nest within the word:  for
  54.           each  additional open brace there must be an additional
  55.           close brace (however, if an open brace or  close  brace
  56.           within  the  word is quoted with a backslash then it is
  57.           not counted in locating the matching close brace).   No
  58.           substitutions  are  performed on the characters between
  59.           the braces except for  backslash-newline  substitutions
  60.           described  below,  nor  do semi-colons, newlines, close
  61.           brackets, or white space receive any special  interpre-
  62.           tation.   The  word will consist of exactly the charac-
  63.           ters between the outer braces, not including the braces
  64.           themselves.
  65.  
  66.      [6]  If a word contains an open  bracket  (``['')  then  Tcl
  67.           performs  command  substitution.  To do this it invokes
  68.           the Tcl interpreter recursively to process the  charac-
  69.           ters  following  the open bracket as a Tcl script.  The
  70.           script may contain any number of commands and  must  be
  71.           terminated  by  a close bracket (``]'').  The result of
  72.           the script (i.e. the result of  its  last  command)  is
  73.           substituted  into the word in place of the brackets and
  74.           all of the characters between them.  There may  be  any
  75.           number of command substitutions in a single word.  Com-
  76.           mand substitution is not performed on words enclosed in
  77.           braces.
  78.  
  79.      [7]  If a word contains a dollar-sign (``$'') then Tcl  per-
  80.           forms  variable  substitution:  the dollar-sign and the
  81.           following characters are replaced in the  word  by  the
  82.           value  of a variable.  Variable substition may take any
  83.           of the following forms:
  84.  
  85.           $name          Name is the name of a  scalar  variable;
  86.                          the  name is terminated by any character
  87.                          that isn't a letter,  digit,  or  under-
  88.                          score.
  89.  
  90.           $name(index)   Name gives the name of an array variable
  91.                          and  index  gives the name of an element
  92.                          within that array.   Name  must  contain
  93.                          only  letters,  digits, and underscores.
  94.                          Command substitutions, variable  substi-
  95.                          tutions, and backslash substitutions are
  96.                          performed on the characters of index.
  97.  
  98.           ${name}        Name is the name of a  scalar  variable.
  99.                          It may contain any characters whatsoever
  100.                          except for close braces.
  101.  
  102.      There may be any number of variable substitutions in a  sin-
  103.      gle  word.   Variable substitution is not performed on words
  104.      enclosed in braces.
  105.  
  106.      [8]  If a backslash  (``\'')  appears  within  a  word  then
  107.           backslash  substitution occurs.  In all cases but those  |
  108.           described below the backslash is dropped and  the  fol-  |
  109.           lowing  character  is  treated as an ordinary character  |
  110.           and included in the word.  This allows characters  such
  111.           as  double  quotes, close brackets, and dollar signs to
  112.           be included in words without  triggering  special  pro-
  113.           cessing.   The  following  table  lists  the  backslash
  114.           sequences that are handled specially,  along  with  the
  115.           value that replaces each sequence.
  116.  
  117.           \a                                                            ||
  118.                 Audible alert (bell) (0x7).
  119.  
  120.           \b    Backspace (0x8).
  121.  
  122.           \f    Form feed (0xc).
  123.  
  124.           \n    Newline (0xa).
  125.  
  126.           \r    Carriage-return (0xd).
  127.  
  128.           \t    Tab (0x9).
  129.  
  130.           \v    Vertical tab (0xb).
  131.  
  132.           \<newline>whiteSpace
  133.                 A single space character replaces the  backslash,  |
  134.                 newline,  and  all white space after the newline.  |
  135.                 This backslash sequence is unique in that  it  is  |
  136.                 replaced  in  a separate pre-pass before the com-  |
  137.                 mand is actually parsed.  This means that it will  |
  138.                 be  replaced  even when it occurs between braces,  |
  139.                 and the resulting space will be treated as a word  |
  140.                 separator if it isn't in braces or quotes.
  141.  
  142.           \\    Backslash (``\'').
  143.  
  144.           \ooo  The digits ooo (one, two, or three of them)  give
  145.                 the octal value of the character.
  146.  
  147.           \xhh  The hexadecimal digits hh  give  the  hexadecimal  |
  148.                 value of the character.  Any number of digits may  |
  149.                 be present.
  150.  
  151.      Backslash substitution is not performed on words enclosed in
  152.      braces, except for backslash-newline as described above.
  153.  
  154.      [9]  If a hash character (``#'') appears at  a  point  where
  155.           Tcl  is expecting the first character of the first word
  156.           of a command, then the hash character and  the  charac-
  157.           ters  that  follow it, up through the next newline, are
  158.           treated as a comment and ignored.  The comment  charac-
  159.           ter only has significance when it appears at the begin-
  160.           ning of a command.
  161.  
  162.      [10] Each character is processed exactly  once  by  the  Tcl
  163.           interpreter as part of creating the words of a command.
  164.  
  165.           For example, if  variable  substition  occurs  then  no
  166.           further  substitions  are performed on the value of the
  167.           variable;  the value is inserted into the  word  verba-
  168.           tim.   If  command  substitution occurs then the nested
  169.           command is processed entirely by the recursive call  to
  170.           the  Tcl  interpreter;  no  substitutions  are perfomed
  171.           before making the recursive call and no additional sub-
  172.           stitutions  are  performed  on the result of the nested
  173.           script.
  174.  
  175.      [11] Substitutions do not affect the word  boundaries  of  a
  176.           command.  For example, during variable substitution the
  177.           entire value of the variable becomes part of  a  single
  178.           word, even if the variable's value contains spaces.
  179.  
  180.  
  181.  
  182. Tcl                      Last change:                           4
  183.  
  184.  
  185.  
  186. _________________________________________________________________
  187.  
  188. NAME
  189.      append - Append to variable
  190.  
  191. SYNOPSIS
  192.      append varName value ?value value ...?
  193. _________________________________________________________________
  194.  
  195.  
  196. DESCRIPTION
  197.      Append all of the value arguments to the  current  value  of
  198.      variable  varName.   If varName doesn't exist, it is given a
  199.      value equal to the concatenation of all the value arguments.
  200.      This  command  provides  an  efficient  way to build up long
  201.      variables incrementally.  For example, ``append  a  $b''  is
  202.      much more efficient than ``set a $a$b'' if $a is long.
  203.  
  204.  
  205. KEYWORDS
  206.      append, variable
  207.  
  208.  
  209. _________________________________________________________________
  210.  
  211. NAME
  212.      array - Manipulate array variables
  213.  
  214. SYNOPSIS
  215.      array option arrayName ?arg arg ...?
  216. _________________________________________________________________
  217.  
  218.  
  219. DESCRIPTION
  220.      This command performs one of several operations on the vari-
  221.      able  given  by arrayName.  ArrayName must be the name of an
  222.      existing array variable.   The  option  argument  determines
  223.      what  action  is  carried  out  by  the  command.  The legal
  224.      options (which may be abbreviated) are:
  225.  
  226.      array anymore arrayName searchId
  227.           Returns 1 if there are any more  elements  left  to  be
  228.           processed  in  an  array search, 0 if all elements have
  229.           already been returned.  SearchId indicates which search
  230.           on  arrayName  to  check, and must have been the return
  231.           value from a previous invocation of array  startsearch.
  232.           This  option  is particularly useful if an array has an
  233.           element with an empty name, since the return value from
  234.           array nextelement won't indicate whether the search has
  235.           been completed.
  236.  
  237.      array donesearch arrayName searchId
  238.           This command terminates an array  search  and  destroys
  239.           all  the  state  associated with that search.  SearchId
  240.           indicates which search on  arrayName  to  destroy,  and
  241.           must have been the return value from a previous invoca-
  242.           tion of array startsearch.  Returns an empty string.
  243.  
  244.      array names arrayName
  245.           Returns a list containing the names of all of the  ele-
  246.           ments  in  the  array.  If there are no elements in the
  247.           array then an empty string is returned.
  248.  
  249.      array nextelement arrayName searchId
  250.           Returns the name of the next element in  arrayName,  or
  251.           an  empty  string  if  all  elements  of arrayName have
  252.           already been returned in  this  search.   The  searchId
  253.           argument  identifies the search, and must have been the
  254.           return value of an array startsearch command.  Warning:
  255.           if  elements  are  added  to or deleted from the array,
  256.           then all searches are automatically terminated just  as
  257.           if  array  donesearch had been invoked; this will cause
  258.           array  nextelement  operations  to   fail   for   those
  259.           searches.
  260.  
  261.      array size arrayName
  262.           Returns a decimal string giving the number of  elements
  263.           in the array.
  264.  
  265.      array startsearch arrayName
  266.           This command initializes an  element-by-element  search
  267.           through the array given by arrayName, such that invoca-
  268.           tions of the array nextelement command will return  the
  269.           names  of  the  individual elements in the array.  When
  270.           the search has been  completed,  the  array  donesearch
  271.           command  should  be  invoked.   The  return  value is a
  272.           search identifier that must be used in  array  nextele-
  273.           ment  and array donesearch commands; it allows multiple
  274.           searches to be underway  simultaneously  for  the  same
  275.           array.
  276.  
  277.  
  278. KEYWORDS
  279.      array, element names, search
  280.  
  281.  
  282. _________________________________________________________________
  283.  
  284. NAME
  285.      break - Abort looping command
  286.  
  287. SYNOPSIS
  288.      break
  289. _________________________________________________________________
  290.  
  291.  
  292. DESCRIPTION
  293.      This command may be invoked only inside the body of a  loop-
  294.      ing  command  such as for or foreach or while.  It returns a
  295.      TCL_BREAK code to signal the innermost containing loop  com-
  296.      mand to return immediately.
  297.  
  298.  
  299. KEYWORDS
  300.      abort, break, loop
  301.  
  302.  
  303. _________________________________________________________________
  304.  
  305. NAME
  306.      case - Evaluate one of several scripts, depending on a given
  307.      value
  308.  
  309. SYNOPSIS
  310.      case string ?in? patList body ?patList body ...?
  311.      case string ?in? {patList body ?patList body ...?}
  312. _________________________________________________________________
  313.  
  314.  
  315. DESCRIPTION
  316.      Note: the case command is obsolete and is supported only for
  317.      backward  compatibility.  At some point in the future it may
  318.      be removed entirely.  You  should  use  the  switch  command
  319.      instead.
  320.  
  321.      The case command matches string against each of the  patList
  322.      arguments  in order.  Each patList argument is a list of one
  323.      or more patterns.  If any of these patterns  matches  string
  324.      then  case  evaluates the following body argument by passing
  325.      it recursively to the Tcl interpreter and returns the result
  326.      of  that  evaluation.   Each  patList argument consists of a
  327.      single pattern or list of patterns.  Each pattern  may  con-
  328.      tain any of the wild-cards described under string match.  If
  329.      a patList argument is default, the corresponding  body  will
  330.      be  evaluated  if  no patList matches string.  If no patList
  331.      argument matches string and no default is  given,  then  the
  332.      case command returns an empty string.
  333.  
  334.      Two syntaxes are provided for the  patList  and  body  argu-
  335.      ments.   The  first uses a separate argument for each of the
  336.      patterns and commands; this form is convenient if  substitu-
  337.      tions  are desired on some of the patterns or commands.  The
  338.      second form places all of the patterns and commands together
  339.      into  a  single argument; the argument must have proper list
  340.      structure, with the elements of the list being the  patterns
  341.      and  commands.   The  second form makes it easy to construct
  342.      multi-line case commands, since the braces around the  whole
  343.      list  make  it unnecessary to include a backslash at the end
  344.      of each line.  Since the patList arguments are in braces  in
  345.      the  second  form,  no command or variable substitutions are
  346.      performed on them;  this makes the behavior  of  the  second
  347.      form different than the first form in some cases.
  348.  
  349.  
  350. KEYWORDS
  351.      case, match, regular expression
  352.  
  353.  
  354. _________________________________________________________________
  355.  
  356. NAME
  357.      catch - Evaluate script and trap exceptional returns
  358.  
  359. SYNOPSIS
  360.      catch script ?varName?
  361. _________________________________________________________________
  362.  
  363.  
  364. DESCRIPTION
  365.      The catch command may be used to prevent errors from  abort-
  366.      ing command interpretation.  Catch calls the Tcl interpreter
  367.      recursively to execute script, and always returns  a  TCL_OK
  368.      code,  regardless  of any errors that might occur while exe-
  369.      cuting script.  The return value from  catch  is  a  decimal
  370.      string giving the code returned by the Tcl interpreter after
  371.      executing script.  This will be 0 (TCL_OK) if there were  no
  372.      errors  in  script;  otherwise it will have a non-zero value
  373.      corresponding to one of the exceptional  return  codes  (see
  374.      tcl.h  for  the definitions of code values).  If the varName
  375.      argument is given, then it gives the  name  of  a  variable;
  376.      catch  will  set  the  variable  to the string returned from
  377.      script (either a result or an error message).
  378.  
  379.  
  380. KEYWORDS
  381.      catch, error
  382.  
  383.  
  384. _________________________________________________________________
  385.  
  386. NAME
  387.      cd - Change working directory
  388.  
  389. SYNOPSIS
  390.      cd ?dirName?
  391. _________________________________________________________________
  392.  
  393.  
  394. DESCRIPTION
  395.      Change the current working directory to dirName, or  to  the
  396.      home  directory  (as specified in the HOME environment vari-
  397.      able) if dirName is not given.  If  dirName  starts  with  a
  398.      tilde,   then  tilde-expansion  is  done  as  described  for
  399.      Tcl_TildeSubst.  Returns an empty string.
  400.  
  401.  
  402. KEYWORDS
  403.      working directory
  404.  
  405.  
  406. _________________________________________________________________
  407.  
  408. NAME
  409.      close - Close an open file
  410.  
  411. SYNOPSIS
  412.      close fileId
  413. _________________________________________________________________
  414.  
  415.  
  416. DESCRIPTION
  417.      Closes the file given by fileId.  FileId must be the  return
  418.      value  from a previous invocation of the open command; after
  419.      this command, it should not  be  used  anymore.   If  fileId
  420.      refers  to  a command pipeline instead of a file, then close
  421.      waits for the children to complete.  The  normal  result  of
  422.      this  command is an empty string, but errors are returned if
  423.      there are problems in closing the file or waiting for  chil-
  424.      dren to complete.
  425.  
  426.  
  427. KEYWORDS
  428.      close, file
  429.  
  430.  
  431. _________________________________________________________________
  432.  
  433. NAME
  434.      concat - Join lists together
  435.  
  436. SYNOPSIS
  437.      concat ?arg arg ...?                                          |
  438. _________________________________________________________________
  439.  
  440.  
  441. DESCRIPTION
  442.      This command treats each argument as a list and concatenates
  443.      them  into  a  single  list.  It also eliminates leading and
  444.      trailing spaces in the arg's and  adds  a  single  separator
  445.      space  between  arg's.   It permits any number of arguments.
  446.      For example, the command
  447.  
  448.           concat a b {c d e} {f {g h}}
  449.      will return
  450.  
  451.           a b c d e f {g h}
  452.      as its result.
  453.  
  454.      If no args are supplied, the result is an empty string.       |
  455.  
  456.  
  457. KEYWORDS
  458.      concatenate, join, lists
  459.  
  460.  
  461. _________________________________________________________________
  462.  
  463. NAME
  464.      continue - Skip to the next iteration of a loop
  465.  
  466. SYNOPSIS
  467.      continue
  468. _________________________________________________________________
  469.  
  470.  
  471. DESCRIPTION
  472.      This command may be invoked only inside the body of a  loop-
  473.      ing  command  such as for or foreach or while.  It returns a
  474.      TCL_CONTINUE code to signal the  innermost  containing  loop
  475.      command  to  skip  the remainder of the loop's body but con-
  476.      tinue with the next iteration of the loop.
  477.  
  478.  
  479. KEYWORDS
  480.      continue, iteration, loop
  481.  
  482.  
  483. _________________________________________________________________
  484.  
  485. NAME
  486.      eof - Check for end-of-file condition on open file
  487.  
  488. SYNOPSIS
  489.      eof fileId
  490. _________________________________________________________________
  491.  
  492.  
  493. DESCRIPTION
  494.      Returns 1  if  an  end-of-file  condition  has  occurred  on
  495.      fileId, 0 otherwise.  FileId must have been the return value
  496.      from a previous call to open, or it may be stdin, stdout, or
  497.      stderr to refer to one of the standard I/O channels.
  498.  
  499.  
  500. KEYWORDS
  501.      end, file
  502.  
  503.  
  504. _________________________________________________________________
  505.  
  506. NAME
  507.      error - Generate an error
  508.  
  509. SYNOPSIS
  510.      error message ?info? ?code?
  511. _________________________________________________________________
  512.  
  513.  
  514. DESCRIPTION
  515.      Returns a TCL_ERROR code, which causes  command  interpreta-
  516.      tion to be unwound.  Message is a string that is returned to
  517.      the application to indicate what went wrong.
  518.  
  519.      If the info argument is provided and  is  non-empty,  it  is
  520.      used to initialize the global variable errorInfo.  errorInfo
  521.      is used to accumulate a stack trace of what was in  progress
  522.      when  an  error occurred; as nested commands unwind, the Tcl
  523.      interpreter adds information  to  errorInfo.   If  the  info
  524.      argument  is present, it is used to initialize errorInfo and
  525.      the first increment of unwind information will not be  added
  526.      by  the  Tcl  interpreter.  In other words, the command con-
  527.      taining the error command will not appear in  errorInfo;  in
  528.      its place will be info.  This feature is most useful in con-
  529.      junction with the catch command: if a caught error cannot be
  530.      handled  successfully,  info  can  be used to return a stack
  531.      trace reflecting the original point  of  occurrence  of  the
  532.      error:
  533.  
  534.           catch {...} errMsg
  535.           set savedInfo $errorInfo
  536.           ...
  537.           error $errMsg $savedInfo
  538.  
  539.      If the code argument is present, then its value is stored in
  540.      the errorCode global variable.  This variable is intended to
  541.      hold a machine-readable description of the  error  in  cases
  542.      where  such information is available; see the section BUILT-
  543.      IN VARIABLES below for information on the proper format  for
  544.      the  variable.   If  the  code argument is not present, then
  545.      errorCode is automatically reset  to  ``NONE''  by  the  Tcl
  546.      interpreter as part of processing the error generated by the
  547.      command.
  548.  
  549.  
  550. KEYWORDS
  551.      error, errorCode, errorInfo
  552.  
  553.  
  554. _________________________________________________________________
  555.  
  556. NAME
  557.      eval - Evaluate a Tcl script
  558.  
  559. SYNOPSIS
  560.      eval arg ?arg ...?
  561. _________________________________________________________________
  562.  
  563.  
  564. DESCRIPTION
  565.      Eval takes one or more arguments, which together comprise  a
  566.      Tcl  script containing one or more commands.  Eval concaten-
  567.      ates all its arguments in the same  fashion  as  the  concat
  568.      command,  passes  the  concatenated string to the Tcl inter-
  569.      preter recursively, and returns the result of  that  evalua-
  570.      tion (or any error generated by it).
  571.  
  572.  
  573. KEYWORDS
  574.      concatenate, evaluate, script
  575.  
  576.  
  577. _________________________________________________________________
  578.  
  579. NAME
  580.      exec - Invoke subprocess(es)
  581.  
  582. SYNOPSIS
  583.      exec ?switches? arg ?arg ...?
  584. _________________________________________________________________
  585.  
  586.  
  587. DESCRIPTION
  588.      This command treats its arguments as  the  specification  of
  589.      one or more subprocesses to execute.  The arguments take the
  590.      form of a standard shell pipeline where each arg becomes one
  591.      word  of a command, and each distinct command becomes a sub-
  592.      process.
  593.  
  594.      If the initial arguments to exec start with - then they  are  |
  595.      treated  as  command-line  switches  and are not part of the  |
  596.      pipeline  specification.    The   following   switches   are  |
  597.      currently supported:                                          |
  598.  
  599.      -keepnew-  |
  600.                   line                                                       ||
  601.                   Retains a trailing newline  in  the  pipeline's  |
  602.                   output.   Normally  a  trailing newline will be  |
  603.                   deleted.                                         |
  604.  
  605.      --                                                                 ||
  606.                   Marks  the  end of switches.  The argument fol-  |
  607.                   lowing this one will be treated  as  the  first  |
  608.                   arg even if it starts with a -.
  609.  
  610.      If an arg (or pair of arg's) has one of the forms  described
  611.      below  then  it is used by exec to control the flow of input
  612.      and output among the subprocess(es).   Such  arguments  will
  613.      not  be  passed to the subprocess(es).  In forms such as ``<  |
  614.      fileName'' fileName may either be  in  a  separate  argument  |
  615.      from ``<'' or in the same argument with no intervening space  |
  616.      (i.e. ``<fileName'').
  617.  
  618.      |              Separates distinct commands in the  pipeline.
  619.                     The  standard output of the preceding command
  620.                     will be piped into the standard input of  the
  621.                     next command.
  622.  
  623.      |&             Separates distinct commands in the  pipeline.
  624.                     Both  standard  output  and standard error of
  625.                     the preceding command will be piped into  the
  626.                     standard  input  of  the  next command.  This
  627.                     form of redirection overrides forms  such  as
  628.                     2> and >&.
  629.  
  630.      < fileName     The file named by fileName is opened and used
  631.                     as  the  standard input for the first command
  632.                     in the pipeline.
  633.  
  634.      <@ fileId      FileId must be the  identifier  for  an  open  |
  635.                     file,  such as the return value from a previ-  |
  636.                     ous call to open.  It is used as the standard  |
  637.                     input  for the first command in the pipeline.  |
  638.                     FileId must have been opened for reading.
  639.  
  640.      << value       Value is passed to the first command  as  its
  641.                     standard input.
  642.  
  643.      > fileName     Standard output  from  the  last  command  is
  644.                     redirected   to   the  file  named  fileName,
  645.                     overwriting its previous contents.
  646.  
  647.      2> fileName    Standard error from all commands in the pipe-  |
  648.                     line   is   redirected   to  the  file  named  |
  649.                     fileName, overwriting its previous contents.   |
  650.  
  651.      >& fileName                                                        ||
  652.                     Both  standard  output  from the last command  |
  653.                     and standard  error  from  all  commands  are  |
  654.                     redirected   to   the  file  named  fileName,  |
  655.                     overwriting its previous contents.
  656.  
  657.      >> fileName    Standard output  from  the  last  command  is
  658.                     redirected   to   the  file  named  fileName,
  659.                     appending to it rather than overwriting it.
  660.  
  661.      2>> fileName   Standard error from all commands in the pipe-  |
  662.                     line   is   redirected   to  the  file  named  |
  663.                     fileName,  appending  to   it   rather   than  |
  664.                     overwriting it.                                |
  665.  
  666.      >>& fileName                                                       ||
  667.                     Both  standard  output  from the last command  |
  668.                     and standard  error  from  all  commands  are  |
  669.                     redirected   to   the  file  named  fileName,  |
  670.                     appending to it rather than overwriting it.    |
  671.  
  672.      >@ fileId                                                          ||
  673.                     FileId  must  be  the  identifier for an open  |
  674.                     file, such as the return value from a  previ-  |
  675.                     ous  call  to open.  Standard output from the  |
  676.                     last command is redirected to fileId's  file,  |
  677.                     which must have been opened for writing.       |
  678.  
  679.      2>@ fileId                                                         ||
  680.                     FileId  must  be  the  identifier for an open  |
  681.                     file,  such  as  the  return  value  from   a  |
  682.                     previous  call  to open.  Standard error from  |
  683.                     all commands in the pipeline is redirected to  |
  684.                     fileId's  file.   The  file  must  have  been  |
  685.                     opened for writing.                            |
  686.  
  687.      >&@ fileId                                                         ||
  688.                     FileId  must  be  the  identifier for an open  |
  689.                     file, such as the return value from a  previ-  |
  690.                     ous  call to open.  Both standard output from  |
  691.                     the last command and standard error from  all  |
  692.                     commands  are  redirected  to  fileId's file.  |
  693.                     The file must have been opened for writing.
  694.  
  695.      If standard output has not been  redirected  then  the  exec
  696.      command returns the standard output from the last command in
  697.      the pipeline.  If any of the commands in the  pipeline  exit
  698.      abnormally or are killed or suspended, then exec will return
  699.      an error and the error message will include  the  pipeline's
  700.      output  followed  by  error messages describing the abnormal
  701.      terminations; the errorCode variable will contain additional
  702.      information about the last abnormal termination encountered.
  703.      If any of the commands writes to its standard error file and
  704.      that  standard error isn't redirected, then exec will return
  705.      an error;  the error message  will  include  the  pipeline's
  706.      standard  output, followed by messages about abnormal termi-
  707.      nations (if any), followed by the standard error output.
  708.  
  709.      If the last character of the result or error  message  is  a
  710.      newline  then  that  character  is normally deleted from the
  711.      result or error message.  This is consistent with other  Tcl
  712.      return values, which don't normally end with newlines.  How-  |
  713.      ever, if -keepnewline is specified then the trailing newline  |
  714.      is retained.
  715.  
  716.      If standard input isn't redirected with ``<'' or  ``<<''  or
  717.      ``<@''  then the standard input for the first command in the
  718.      pipeline is taken from the  application's  current  standard
  719.      input.
  720.  
  721.      If the last arg is ``&'' then the pipeline will be  executed
  722.      in  background.  In this case the exec command will return a  |
  723.      list whose elements are the process identifiers for  all  of  |
  724.      the  subprocesses in the pipeline.  The standard output from
  725.      the  last  command  in  the  pipeline   will   go   to   the
  726.      application's  standard output if it hasn't been redirected,
  727.      and error output from all of the commands  in  the  pipeline
  728.      will  go  to  the  application's  standard error file unless
  729.      redirected.
  730.  
  731.      The first word in each command is taken as the command name;
  732.      tilde-substitution  is  performed  on  it, and if the result
  733.      contains  no  slashes  then  the  directories  in  the  PATH
  734.      environment  variable  are searched for an executable by the
  735.      given name.  If the name contains a slash then it must refer
  736.      to  an  executable reachable from the current directory.  No
  737.      ``glob'' expansion or  other  shell-like  substitutions  are
  738.      performed on the arguments to commands.
  739.  
  740.  
  741. KEYWORDS
  742.      execute, pipeline, redirection, subprocess
  743.  
  744.  
  745. _________________________________________________________________
  746.  
  747. NAME
  748.      exit - End the application
  749.  
  750. SYNOPSIS
  751.      exit ?returnCode?
  752. _________________________________________________________________
  753.  
  754.  
  755. DESCRIPTION
  756.      Terminate the process, returning returnCode to the system as
  757.      the  exit  status.   If  returnCode  isn't specified then it
  758.      defaults to 0.
  759.  
  760.  
  761. KEYWORDS
  762.      exit, process
  763.  
  764.  
  765. _________________________________________________________________
  766.  
  767. NAME
  768.      expr - Evalue an expression
  769.  
  770. SYNOPSIS
  771.      expr arg ?arg arg ...?
  772. _________________________________________________________________
  773.  
  774.  
  775. DESCRIPTION
  776.      Concatenates arg's (adding separator spaces  between  them),  |
  777.      evaluates  the  result  as a Tcl expression, and returns the  |
  778.      value.  The operators permitted in  Tcl  expressions  are  a
  779.      subset of the operators permitted in C expressions, and they
  780.      have the same meaning and precedence as the corresponding  C
  781.      operators.   Expressions almost always yield numeric results
  782.      (integer  or  floating-point  values).   For  example,   the
  783.      expression
  784.  
  785.           expr 8.2 + 6
  786.      evaluates to 14.2.  Tcl expressions differ  from  C  expres-
  787.      sions  in  the  way  that operands are specified.  Also, Tcl
  788.      expressions support non-numeric  operands  and  string  com-
  789.      parisons.
  790.  
  791. OPERANDS
  792.      A Tcl expression consists  of  a  combination  of  operands,
  793.      operators, and parentheses.  White space may be used between
  794.      the operands and operators and parentheses; it is ignored by
  795.      the  expression  processor.   Where  possible,  operands are
  796.      interpreted as integer values.  Integer values may be speci-
  797.      fied  in  decimal  (the normal case), in octal (if the first
  798.      character of the operand is 0), or in  hexadecimal  (if  the
  799.      first  two characters of the operand are 0x).  If an operand
  800.      does not have one of the integer formats given  above,  then
  801.      it  is  treated as a floating-point number if that is possi-
  802.      ble.  Floating-point numbers may be specified in any of  the
  803.      ways  accepted  by an ANSI-compliant C compiler (except that
  804.      the ``f'', ``F'', ``l'', and ``L'' suffixes will not be per-
  805.      mitted in most installations).  For example, all of the fol-
  806.      lowing are valid  floating-point  numbers:   2.1,  3.,  6e4,
  807.      7.91e+16.  If no numeric interpretation is possible, then an
  808.      operand is left as a string  (and  only  a  limited  set  of
  809.      operators may be applied to it).
  810.  
  811.      Operands may be specified in any of the following ways:
  812.  
  813.      [1]  As an numeric value, either integer or floating-point.
  814.  
  815.      [2]  As a Tcl variable,  using  standard  $  notation.   The
  816.           variable's value will be used as the operand.
  817.  
  818.      [3]  As a string enclosed in double-quotes.  The  expression
  819.           parser  will  perform  backslash, variable, and command
  820.           substitutions on the information  between  the  quotes,
  821.           and use the resulting value as the operand
  822.  
  823.      [4]  As a string enclosed in braces.  The characters between
  824.           the open brace and matching close brace will be used as
  825.           the operand without any substitutions.
  826.  
  827.      [5]  As a Tcl command enclosed  in  brackets.   The  command
  828.           will  be  executed  and  its result will be used as the
  829.           operand.
  830.  
  831.      [6]  As a mathematical function whose arguments have any  of  |
  832.           the above forms for operands, such as ``sin($x)''.  See  |
  833.           below for a list of defined functions.
  834.  
  835.      Where  substitutions  occur  above   (e.g.   inside   quoted
  836.      strings),  they  are  performed by the expression processor.
  837.      However, an additional layer  of  substitution  may  already
  838.      have been performed by the command parser before the expres-
  839.      sion processor was called.  As discussed below, it  is  usu-
  840.      ally  best  to  enclose expressions in braces to prevent the
  841.      command parser from performing  substitutions  on  the  con-
  842.      tents.
  843.  
  844.      For some examples of simple expressions, suppose  the  vari-
  845.      able  a  has the value 3 and the variable b has the value 6.
  846.      Then the command on the left side of each of the lines below
  847.      will produce the value on the right side of the line:
  848.  
  849.           expr 3.1 + $a           6.1
  850.           expr 2 + "$a.$b"        5.6
  851.           expr 4*[llength "6 2"]  8
  852.           expr {{word one} < "word $a"}0
  853.  
  854. OPERATORS
  855.      The valid operators are listed below, grouped in  decreasing
  856.      order of precedence:
  857.  
  858.      -  ~  !             Unary minus, bit-wise NOT, logical  NOT.
  859.                          None of these operands may be applied to
  860.                          string operands, and bit-wise NOT may be
  861.                          applied only to integers.
  862.  
  863.      *  /  %             Multiply, divide,  remainder.   None  of
  864.                          these  operands may be applied to string
  865.                          operands, and remainder may  be  applied
  866.                          only  to  integers.   The remainder will  |
  867.                          always have the same sign as the divisor  |
  868.                          and  an  absolute value smaller than the  |
  869.                          divisor.
  870.  
  871.      +  -                Add and subtract.  Valid for any numeric
  872.                          operands.
  873.  
  874.      <<  >>              Left and right shift.  Valid for integer
  875.                          operands only.
  876.  
  877.      <  >  <=  >=        Boolean  less,  greater,  less  than  or
  878.                          equal,  and greater than or equal.  Each
  879.                          operator produces 1 if the condition  is
  880.                          true,  0 otherwise.  These operators may
  881.                          be applied to strings as well as numeric
  882.                          operands,  in  which  case  string  com-
  883.                          parison is used.
  884.  
  885.      ==  !=              Boolean  equal  and  not  equal.    Each
  886.                          operator  produces  a  zero/one  result.
  887.                          Valid for all operand types.
  888.  
  889.      &                   Bit-wise   AND.    Valid   for   integer
  890.                          operands only.
  891.  
  892.      ^                   Bit-wise  exclusive   OR.    Valid   for
  893.                          integer operands only.
  894.  
  895.      |                   Bit-wise OR.  Valid for integer operands
  896.                          only.
  897.  
  898.      &&                  Logical AND.  Produces  a  1  result  if
  899.                          both operands are non-zero, 0 otherwise.
  900.                          Valid   for   numeric   operands    only
  901.                          (integers or floating-point).
  902.  
  903.      ||                  Logical OR.  Produces a 0 result if both
  904.                          operands  are  zero, 1 otherwise.  Valid
  905.                          for numeric operands only  (integers  or
  906.                          floating-point).
  907.  
  908.      x?y:z               If-then-else, as in C.  If  x  evaluates
  909.                          to  non-zero,  then  the  result  is the
  910.                          value of y.  Otherwise the result is the
  911.                          value  of  z.  The x operand must have a
  912.                          numeric value.
  913.  
  914.      See the C manual for more details on the results produced by
  915.      each  operator.   All of the binary operators group left-to-
  916.      right within the same precedence level.   For  example,  the
  917.      command
  918.  
  919.           expr 4*2 < 7
  920.      returns 0.
  921.  
  922.      The &&, ||, and ?: operators have ``lazy evaluation'',  just
  923.      as in C, which means that operands are not evaluated if they
  924.      are not needed to determine the outcome.   For  example,  in
  925.      the command
  926.  
  927.           expr {$v ? [a] : [b]}
  928.      only one of [a] or [b] will actually be evaluated, depending
  929.      on  the  value of $v.  Note, however, that this is only true
  930.      if the entire expression is enclosed in  braces;   otherwise
  931.      the  Tcl parser will evaluate both [a] and [b] before invok-
  932.      ing the expr command.
  933.  
  934. MATH FUNCTIONS
  935.      Tcl supports the following mathematical functions in expres-  |
  936.      sions:                                                        |
  937.  
  938.           acos        cos         hypot      sinh                  |
  939.           asin        cosh        log        sqrt                  |
  940.           atan        exp         log10      tan                   |
  941.           atan2       floor       pow        tanh                  |
  942.           ceil        fmod        sin                              |
  943.      Each of these functions invokes the math library function of  |
  944.      the same name;  see the manual entries for the library func-  |
  945.      tions for details on what they do.  Tcl also implements  the  |
  946.      following  functions  for  conversion  between  integers and  |
  947.      floating-point numbers:                                       |
  948.  
  949.      abs(arg)                                                           ||
  950.           Returns  the  absolute value of arg.  Arg may be either  |
  951.           integer or floating-point, and the result  is  returned  |
  952.           in the same form.                                        |
  953.  
  954.      double(arg)                                                        ||
  955.           If arg is a floating value, returns arg, otherwise con-  |
  956.           verts arg to floating and returns the converted value.   |
  957.  
  958.      int(arg)                                                           ||
  959.           If arg is an integer value, returns arg, otherwise con-  |
  960.           verts arg to integer by truncation and returns the con-  |
  961.           verted value.                                            |
  962.  
  963.      round(arg)                                                         ||
  964.           If arg is an integer value, returns arg, otherwise con-  |
  965.           verts arg to integer by rounding and returns  the  con-  |
  966.           verted value.                                            |
  967.  
  968.      In addition to these predifined functions, applications  may  |
  969.      define additional functions using Tcl_CreateMathFunc().
  970.  
  971. TYPES, OVERFLOW, AND PRECISION
  972.      All internal computations involving integers are  done  with
  973.      the  C  type  long,  and all internal computations involving
  974.      floating-point are done with the C type double.   When  con-
  975.      verting  a  string  to  floating-point, exponent overflow is
  976.      detected and results in a  Tcl  error.   For  conversion  to
  977.      integer  from  string,  detection of overflow depends on the
  978.      behavior of some routines in the  local  C  library,  so  it
  979.      should  be  regarded  as  unreliable.   In any case, integer
  980.      overflow and underflow are generally not  detected  reliably
  981.      for   intermediate  results.   Floating-point  overflow  and
  982.      underflow are  detected  to  the  degree  supported  by  the
  983.      hardware, which is generally pretty reliable.
  984.  
  985.      Conversion  among  internal  representations  for   integer,
  986.      floating-point, and string operands is done automatically as
  987.      needed.  For  arithmetic  computations,  integers  are  used
  988.      until  some floating-point number is introduced, after which
  989.      floating-point is used.  For example,
  990.  
  991.           expr 5 / 4
  992.      returns 1, while
  993.  
  994.           expr 5 / 4.0
  995.           expr 5 / ( [string length "abcd"] + 0.0 )
  996.      both return 1.25.  Floating-point values are always returned  |
  997.      with  a  ``.''  or  an ``e'' so that they will not look like  |
  998.      integer values.  For example,                                 |
  999.  
  1000.           expr 20.0/5.0                                            |
  1001.      returns   ``4.0'',   not   ``4''.    The   global   variable  |
  1002.      tcl_precision  determines  the  the  number  of  significant  |
  1003.      digits that are retained when floating values are  converted  |
  1004.      to  strings  (except  that trailing zeroes are omitted).  If  |
  1005.      tcl_precision is unset then 6 digits of precision are  used.  |
  1006.      To  retain  all of the significant bits of an IEEE floating-  |
  1007.      point number set tcl_precision to 17;  if a  value  is  con-  |
  1008.      verted  to  string with 17 digits of precision and then con-  |
  1009.      verted back  to  binary  for  some  later  calculation,  the  |
  1010.      resulting  binary value is guaranteed to be identical to the  |
  1011.      original one.
  1012.  
  1013.  
  1014. STRING OPERATIONS
  1015.      String values may be used  as  operands  of  the  comparison
  1016.      operators,  although  the  expression  evaluator tries to do
  1017.      comparisons as integer or floating-point when  it  can.   If
  1018.      one  of  the  operands  of  a comparison is a string and the
  1019.      other has a numeric value, the numeric operand is  converted
  1020.      back to a string using the C sprintf format specifier %d for
  1021.      integers and %g for floating-point values.  For example, the
  1022.      commands
  1023.  
  1024.           expr {"0x03" > "2"}
  1025.           expr {"0y" < "0x12"}
  1026.      both return 1.  The first comparison is done  using  integer
  1027.      comparison,  and  the second is done using string comparison
  1028.      after the second operand is converted to the string ``18''.
  1029.  
  1030.  
  1031. KEYWORDS
  1032.      arithmetic, boolean, compare, expression
  1033.  
  1034.  
  1035. _________________________________________________________________
  1036.  
  1037. NAME
  1038.      file - Manipulate file names and attributes
  1039.  
  1040. SYNOPSIS
  1041.      file option name ?arg arg ...?
  1042. _________________________________________________________________
  1043.  
  1044.  
  1045. DESCRIPTION
  1046.      This command provides several operations on a file's name or
  1047.      attributes.  Name is the name of a file; if it starts with a
  1048.      tilde, then tilde substitution is done before executing  the
  1049.      command   (see  the  manual  entry  for  Tcl_TildeSubst  for
  1050.      details).  Option indicates what to do with the  file  name.
  1051.      Any unique abbreviation for option is acceptable.  The valid
  1052.      options are:
  1053.  
  1054.      file atime name
  1055.           Returns a decimal string giving the time at which  file
  1056.           name  was  last  accessed.  The time is measured in the
  1057.           standard POSIX fashion as seconds from a fixed starting
  1058.           time  (often  January  1,  1970).   If the file doesn't
  1059.           exist or its access time  cannot  be  queried  then  an
  1060.           error is generated.
  1061.  
  1062.      file dirname name
  1063.           Returns all of the characters in name  up  to  but  not
  1064.           including  the  last  slash character.  If there are no
  1065.           slashes in name then returns ``.''.  If the last  slash
  1066.           in name is its first character, then return ``/''.
  1067.  
  1068.      file executable name
  1069.           Returns 1 if file name is  executable  by  the  current
  1070.           user, 0 otherwise.
  1071.  
  1072.      file exists name
  1073.           Returns 1 if file name exists and the current user  has
  1074.           search  privileges for the directories leading to it, 0
  1075.           otherwise.
  1076.  
  1077.      file extension name
  1078.           Returns all of the characters in name after and includ-
  1079.           ing  the  last dot in name.  If there is no dot in name
  1080.           then returns the empty string.
  1081.  
  1082.      file isdirectory name
  1083.           Returns 1 if file name is a directory, 0 otherwise.
  1084.  
  1085.      file isfile name
  1086.           Returns 1 if file name is a regular file, 0 otherwise.
  1087.  
  1088.      file lstat name varName
  1089.           Same as stat option (see below) except uses  the  lstat
  1090.           kernel  call  instead of stat.  This means that if name
  1091.           refers to a symbolic link the information  returned  in
  1092.           varName  is for the link rather than the file it refers
  1093.           to.  On systems that don't support symbolic links  this
  1094.           option behaves exactly the same as the stat option.
  1095.  
  1096.      file mtime name
  1097.           Returns a decimal string giving the time at which  file
  1098.           name  was  last  modified.  The time is measured in the
  1099.           standard POSIX fashion as seconds from a fixed starting
  1100.           time  (often  January  1,  1970).   If the file doesn't
  1101.           exist or its modified time cannot be  queried  then  an
  1102.           error is generated.
  1103.  
  1104.      file owned name
  1105.           Returns 1 if file name is owned by the current user,  0
  1106.           otherwise.
  1107.  
  1108.      file readable name
  1109.           Returns 1 if file name is readable by the current user,
  1110.           0 otherwise.
  1111.  
  1112.      file readlink name
  1113.           Returns the value of the symbolic link  given  by  name
  1114.           (i.e.  the  name  of  the  file it points to).  If name
  1115.           isn't a symbolic link or its value cannot be read, then
  1116.           an  error  is  returned.  On systems that don't support
  1117.           symbolic links this option is undefined.
  1118.  
  1119.      file rootname name
  1120.           Returns all of the characters in name  up  to  but  not
  1121.           including  the  last  ``.''  character in the name.  If
  1122.           name doesn't contain a dot, then returns name.
  1123.  
  1124.      file size name
  1125.           Returns a decimal string giving the size of  file  name
  1126.           in bytes.  If the file doesn't exist or its size cannot
  1127.           be queried then an error is generated.
  1128.  
  1129.      file stat  name varName
  1130.           Invokes the stat kernel call  on  name,  and  uses  the
  1131.           variable  given by varName to hold information returned
  1132.           from the kernel call.  VarName is treated as  an  array
  1133.           variable,  and  the following elements of that variable
  1134.           are set: atime, ctime,  dev,  gid,  ino,  mode,  mtime,
  1135.           nlink,  size, type, uid.  Each element except type is a
  1136.           decimal string with  the  value  of  the  corresponding
  1137.           field  from  the  stat return structure; see the manual
  1138.           entry for stat for  details  on  the  meanings  of  the
  1139.           values.  The type element gives the type of the file in
  1140.           the same form returned by the command file type.   This
  1141.           command returns an empty string.
  1142.  
  1143.      file tail name
  1144.           Returns all of the characters in name  after  the  last
  1145.           slash.  If name contains no slashes then returns name.
  1146.  
  1147.      file type name
  1148.           Returns a string giving the type of  file  name,  which
  1149.           will  be  one  of  file,  directory,  characterSpecial,
  1150.           blockSpecial, fifo, link, or socket.
  1151.  
  1152.      file writable name
  1153.           Returns 1 if file name is writable by the current user,
  1154.           0 otherwise.
  1155.  
  1156.  
  1157. KEYWORDS
  1158.      attributes, directory, file, name, stat
  1159.  
  1160.  
  1161. _________________________________________________________________
  1162.  
  1163. NAME
  1164.      flush - Flush buffered output for a file
  1165.  
  1166. SYNOPSIS
  1167.      flush fileId
  1168. _________________________________________________________________
  1169.  
  1170.  
  1171. DESCRIPTION
  1172.      Flushes any  output  that  has  been  buffered  for  fileId.
  1173.      FileId  must have been the return value from a previous call
  1174.      to open, or it may be stdout or stderr to access one of  the
  1175.      standard  I/O  streams;  it  must  refer  to a file that was
  1176.      opened for writing.  The command returns an empty string.
  1177.  
  1178.  
  1179. KEYWORDS
  1180.      buffer, file, flush, output
  1181.  
  1182.  
  1183. _________________________________________________________________
  1184.  
  1185. NAME
  1186.      for - ``For'' loop
  1187.  
  1188. SYNOPSIS
  1189.      for start test next body
  1190. _________________________________________________________________
  1191.  
  1192.  
  1193. DESCRIPTION
  1194.      For is a looping command, similar in structure to the C  for
  1195.      statement.   The start, next, and body arguments must be Tcl
  1196.      command strings, and test is an expression string.  The  for
  1197.      command  first invokes the Tcl interpreter to execute start.
  1198.      Then it repeatedly evaluates test as an expression;  if  the
  1199.      result  is  non-zero it invokes the Tcl interpreter on body,
  1200.      then invokes the Tcl interpreter on next, then  repeats  the
  1201.      loop.   The command terminates when test evaluates to 0.  If
  1202.      a continue command is invoked within body then any remaining
  1203.      commands  in the current execution of body are skipped; pro-
  1204.      cessing continues by invoking the Tcl interpreter  on  next,
  1205.      then  evaluating  test,  and  so  on.  If a break command is
  1206.      invoked within body or  next,  then  the  for  command  will
  1207.      return immediately.  The operation of break and continue are
  1208.      similar to the corresponding statements in C.   For  returns
  1209.      an empty string.
  1210.  
  1211.  
  1212. KEYWORDS
  1213.      for, iteration, looping
  1214.  
  1215.  
  1216. _________________________________________________________________
  1217.  
  1218. NAME
  1219.      foreach - Iterate over all elements in a list
  1220.  
  1221. SYNOPSIS
  1222.      foreach varname list body
  1223. _________________________________________________________________
  1224.  
  1225.  
  1226. DESCRIPTION
  1227.      In this command varname is the name of a variable, list is a
  1228.      list  of  values  to  assign  to  varname, and body is a Tcl
  1229.      script.  For each element of list (in  order  from  left  to
  1230.      right), foreach assigns the contents of the field to varname
  1231.      as if the lindex command had been used to extract the field,
  1232.      then  calls  the Tcl interpreter to execute body.  The break
  1233.      and continue statements may be invoked inside body, with the
  1234.      same effect as in the for command.  Foreach returns an empty
  1235.      string.
  1236.  
  1237.  
  1238. KEYWORDS
  1239.      foreach, iteration, list, looping
  1240.  
  1241.  
  1242. _________________________________________________________________
  1243.  
  1244. NAME
  1245.      format - Format a string in the style of sprintf
  1246.  
  1247. SYNOPSIS
  1248.      format formatString ?arg arg ...?
  1249. _________________________________________________________________
  1250.  
  1251.  
  1252. INTRODUCTION
  1253.      This command generates a formatted string in the same way as
  1254.      the  ANSI C sprintf procedure (it uses sprintf in its imple-
  1255.      mentation).   FormatString  indicates  how  to  format   the
  1256.      result, using % conversion specifiers as in sprintf, and the
  1257.      additional arguments, if any, provide values to  be  substi-
  1258.      tuted  into the result.  The return value from format is the
  1259.      formatted string.
  1260.  
  1261.  
  1262. DETAILS ON FORMATTING
  1263.      The command operates by scanning formatString from  left  to
  1264.      right.  Each character from the format string is appended to
  1265.      the result string unless it is a percent sign.  If the char-
  1266.      acter  is  a  %  then it is not copied to the result string.
  1267.      Instead,  the  characters  following  the  %  character  are
  1268.      treated as a conversion specifier.  The conversion specifier
  1269.      controls the conversion of the next successive arg to a par-
  1270.      ticular  format  and  the  result  is appended to the result
  1271.      string in place of the conversion specifier.  If  there  are
  1272.      multiple  conversion  specifiers  in the format string, then
  1273.      each one controls the conversion of one additional arg.  The
  1274.      format  command  must be given enough args to meet the needs
  1275.      of all of the conversion specifiers in formatString.
  1276.  
  1277.      Each conversion specifier may contain up  to  six  different
  1278.      parts: an XPG3 position specifier, a set of flags, a minimum  |
  1279.      field width, a precision, a length modifier, and  a  conver-
  1280.      sion  character.   Any of these fields may be omitted except
  1281.      for the conversion character.  The fields that  are  present
  1282.      must  appear in the order given above.  The paragraphs below
  1283.      discuss each of these fields in turn.
  1284.  
  1285.      If the % is followed by a decimal number  and  a  $,  as  in  |
  1286.      ``%2$d'',  then  the  value to convert is not taken from the  |
  1287.      next sequential argument.  Instead, it  is  taken  from  the  |
  1288.      argument indicated by the number, where 1 corresponds to the  |
  1289.      first arg.  If the conversion  specifier  requires  multiple  |
  1290.      arguments because of * characters in the specifier then suc-  |
  1291.      cessive arguments are used, starting with the argument given  |
  1292.      by  the number.  This follows the XPG3 conventions for posi-  |
  1293.      tional specifiers.  If there are any  positional  specifiers  |
  1294.      in  formatString  then  all  of the specifiers must be posi-  |
  1295.      tional.
  1296.  
  1297.      The second portion of a conversion specifier may contain any
  1298.      of the following flag characters, in any order:
  1299.  
  1300.      -         Specifies that the converted  argument  should  be
  1301.                left-justified  in its field (numbers are normally
  1302.                right-justified with leading spaces if needed).
  1303.  
  1304.      +         Specifies that a number should always  be  printed
  1305.                with a sign, even if positive.
  1306.  
  1307.      space     Specifies that a space  should  be  added  to  the
  1308.                beginning  of  the  number  if the first character
  1309.                isn't a sign.
  1310.  
  1311.      0         Specifies that the number should be padded on  the
  1312.                left with zeroes instead of spaces.
  1313.  
  1314.      #         Requests an alternate output form.  For  o  and  O
  1315.                conversions  it guarantees that the first digit is
  1316.                always 0.  For  x  or  X  conversions,  0x  or  0X
  1317.                (respectively)  will  be added to the beginning of
  1318.                the result unless it is zero.  For  all  floating-
  1319.                point  conversions  (e, E, f, g, and G) it guaran-
  1320.                tees that the result always has a  decimal  point.
  1321.                For g and G conversions it specifies that trailing
  1322.                zeroes should not be removed.
  1323.  
  1324.      The third portion of a conversion specifier is a number giv-
  1325.      ing  a minimum field width for this conversion.  It is typi-
  1326.      cally used to make columns line up in tabular printouts.  If
  1327.      the  converted  argument  contains fewer characters than the
  1328.      minimum field width then it will be padded so that it is  as
  1329.      wide as the minimum field width.  Padding normally occurs by
  1330.      adding extra spaces on the left of the  converted  argument,
  1331.      but  the  0  and - flags may be used to specify padding with
  1332.      zeroes on the left or with  spaces  on  the  right,  respec-
  1333.      tively.  If the minimum field width is specified as * rather
  1334.      than a number, then the next argument to the format  command
  1335.      determines  the  minimum  field  width; it must be a numeric
  1336.      string.
  1337.  
  1338.      The fourth portion of a conversion specifier is a precision,
  1339.      which consists of a period followed by a number.  The number
  1340.      is used in different ways for different conversions.  For e,
  1341.      E,  and  f  conversions it specifies the number of digits to
  1342.      appear to the right of the  decimal  point.   For  g  and  G
  1343.      conversions  it  specifies  the  total  number  of digits to
  1344.      appear, including those on both sides of the  decimal  point
  1345.      (however, trailing zeroes after the decimal point will still
  1346.      be omitted unless the  #  flag  has  been  specified).   For
  1347.      integer conversions, it specifies a mimimum number of digits
  1348.      to print (leading zeroes will be added if necessary).  For s
  1349.      conversions it specifies the maximum number of characters to
  1350.      be printed; if the string  is  longer  than  this  then  the
  1351.      trailing  characters  will  be dropped.  If the precision is
  1352.      specified with * rather than a number then the next argument
  1353.      to the format command determines the precision; it must be a
  1354.      numeric string.
  1355.  
  1356.      The fourth part of a conversion specifier is a length modif-
  1357.      ier, which must be h or l.  If it is h it specifies that the
  1358.      numeric value should be truncated to a 16-bit  value  before
  1359.      converting.   This  option is rarely useful.  The l modifier
  1360.      is ignored.
  1361.  
  1362.      The last thing in a conversion specifier  is  an  alphabetic
  1363.      character  that  determines  what kind of conversion to per-
  1364.      form.  The following  conversion  characters  are  currently
  1365.      supported:
  1366.  
  1367.      d         Convert integer to signed decimal string.
  1368.  
  1369.      u         Convert integer to unsigned decimal string.
  1370.  
  1371.      i         Convert integer to  signed  decimal  string;   the
  1372.                integer may either be in decimal, in octal (with a
  1373.                leading 0) or in hexadecimal (with a leading 0x).
  1374.  
  1375.      o         Convert integer to unsigned octal string.
  1376.  
  1377.      x or X    Convert integer to  unsigned  hexadecimal  string,
  1378.                using   digits   ``0123456789abcdef''  for  x  and
  1379.                ``0123456789ABCDEF'' for X).
  1380.  
  1381.      c         Convert  integer  to  the   8-bit   character   it
  1382.                represents.
  1383.  
  1384.      s         No conversion; just insert string.
  1385.  
  1386.      f         Convert floating-point number  to  signed  decimal
  1387.                string of the form xx.yyy, where the number of y's
  1388.                is determined by the precision (default:  6).   If
  1389.                the  precision  is 0 then no decimal point is out-
  1390.                put.
  1391.  
  1392.      e or e    Convert floating-point number to scientific  nota-
  1393.                tion  in  the  form x.yyye+__zz, where the number of
  1394.                y's is determined by the precision  (default:  6).
  1395.                If  the  precision  is  0 then no decimal point is
  1396.                output.  If the E form is used then E  is  printed
  1397.                instead of e.
  1398.  
  1399.      g or G    If the exponent is less than -4 or greater than or
  1400.                equal  to  the  precision,  then convert floating-
  1401.                point number as for %e or %E.   Otherwise  convert
  1402.                as for %f.  Trailing zeroes and a trailing decimal
  1403.                point are omitted.
  1404.  
  1405.      %         No conversion: just insert %.
  1406.  
  1407.      For the numerical conversions the argument  being  converted
  1408.      must be an integer or floating-point string; format converts
  1409.      the argument to binary and then converts it back to a string
  1410.      according to the conversion specifier.
  1411.  
  1412.  
  1413. DIFFERENCES FROM ANSI SPRINTF
  1414.      The behavior of the format command is the same as the ANSI C  |
  1415.      sprintf procedure except for the following differences:       |
  1416.  
  1417.      [1]                                                                ||
  1418.           %p and %n specifiers are not currently supported.
  1419.  
  1420.      [2]  For %c conversions  the  argument  must  be  a  decimal
  1421.           string, which will then be converted to the correspond-
  1422.           ing character value.
  1423.  
  1424.      [3]  The l modifier is ignored;  integer values  are  always  |
  1425.           converted as if there were no modifier present and real  |
  1426.           values are always converted as if the l  modifier  were  |
  1427.           present  (i.e.  type  double  is  used for the internal  |
  1428.           representation).  If the h modifier is  specified  then  |
  1429.           integer  values  are  truncated to short before conver-  |
  1430.           sion.
  1431.  
  1432.  
  1433. KEYWORDS
  1434.      conversion specifier, format, sprintf, string, substitution
  1435.  
  1436.  
  1437. _________________________________________________________________
  1438.  
  1439. NAME
  1440.      gets - Read a line from a file
  1441.  
  1442. SYNOPSIS
  1443.      gets fileId ?varName?
  1444. _________________________________________________________________
  1445.  
  1446.  
  1447. DESCRIPTION
  1448.      This command reads the next line  from  the  file  given  by
  1449.      fileId  and  discards the terminating newline character.  If
  1450.      varName is specified then the line is placed in the variable
  1451.      by  that  name and the return value is a count of the number
  1452.      of characters read (not including the newline).  If the  end
  1453.      of the file is reached before reading any characters then -1
  1454.      is returned and varName is set to an empty string.  If  var-
  1455.      Name is not specified then the return value will be the line
  1456.      (minus the newline character) or an empty string if the  end
  1457.      of  the  file  is reached before reading any characters.  An
  1458.      empty string will also be returned if  a  line  contains  no
  1459.      characters except the newline, so eof may have to be used to
  1460.      determine what really happened.  If the  last  character  in
  1461.      the  file is not a newline character then gets behaves as if
  1462.      there were an additional newline character at the end of the
  1463.      file.   FileId must be stdin or the return value from a pre-
  1464.      vious call to open; it must refer to a file that was  opened
  1465.      for reading.  Any existing end-of-file or error condition on  |
  1466.      the file is cleared at the beginning of the gets command.
  1467.  
  1468.  
  1469. KEYWORDS
  1470.      file, line, read
  1471.  
  1472.  
  1473. _________________________________________________________________
  1474.  
  1475. NAME
  1476.      glob - Return names of files that match patterns
  1477.  
  1478. SYNOPSIS
  1479.      glob ?switches? pattern ?pattern ...?
  1480. _________________________________________________________________
  1481.  
  1482.  
  1483. DESCRIPTION
  1484.      This command performs file name ``globbing''  in  a  fashion
  1485.      similar  to  the  csh shell.  It returns a list of the files
  1486.      whose names match any of the pattern arguments.
  1487.  
  1488.      If the initial arguments to glob start with - then they  are  |
  1489.      treated  as  switches.  The following switches are currently  |
  1490.      supported:                                                    |
  1491.  
  1492.      -nocom-  |
  1493.                     plain                                                        ||
  1494.                     Allows an empty list to be  returned  without  |
  1495.                     error;   without  this  switch  an  error  is  |
  1496.                     returned if the result list would be empty.    |
  1497.  
  1498.      --                                                                 ||
  1499.                     Marks the end of switches.  The argument fol-  |
  1500.                     lowing this one will be treated as a  pattern  |
  1501.                     even if it starts with a -.
  1502.  
  1503.      The pattern arguments may contain any of the following  spe-
  1504.      cial characters:
  1505.  
  1506.      ?         Matches any single character.
  1507.  
  1508.      *         Matches any sequence of zero or more characters.
  1509.  
  1510.      [chars]   Matches any single character in chars.   If  chars
  1511.                contains a sequence of the form a-b then any char-
  1512.                acter between a and b (inclusive) will match.
  1513.  
  1514.      \x        Matches the character x.
  1515.  
  1516.      {a,b,...} Matches any of the strings a, b, etc.
  1517.  
  1518.      As with csh, a  ``.'' at the beginning of a file's  name  or
  1519.      just  after  a ``/'' must be matched explicitly or with a {}
  1520.      construct.   In  addition,  all  ``/''  characters  must  be
  1521.      matched explicitly.
  1522.  
  1523.      If the first character in a pattern is ``~'' then it  refers
  1524.      to  the  home  directory for the user whose name follows the
  1525.      ``~''.  If the ``~'' is followed immediately by  ``/''  then
  1526.      the value of the HOME environment variable is used.
  1527.  
  1528.      The glob command differs from  csh  globbing  in  two  ways.
  1529.      First,  it does not sort its result list (use the lsort com-
  1530.      mand if you  want  the  list  sorted).   Second,  glob  only  |
  1531.      returns  the  names of files that actually exist;  in csh no  |
  1532.      check for existence is made unless a pattern contains  a  ?,  |
  1533.      *, or [] construct.
  1534.  
  1535.  
  1536. KEYWORDS
  1537.      exist, file, glob, pattern
  1538.  
  1539.  
  1540. _________________________________________________________________
  1541.  
  1542. NAME
  1543.      global - Access global variables
  1544.  
  1545. SYNOPSIS
  1546.      global varname ?varname ...?
  1547. _________________________________________________________________
  1548.  
  1549.  
  1550. DESCRIPTION
  1551.      This command is ignored unless  a  Tcl  procedure  is  being
  1552.      interpreted.   If so then it declares the given varname's to
  1553.      be global variables rather than local ones.  For  the  dura-
  1554.      tion  of  the current procedure (and only while executing in
  1555.      the current procedure), any reference to any of the varnames
  1556.      will refer to the global variable by the same name.
  1557.  
  1558.  
  1559. KEYWORDS
  1560.      global, procedure, variable
  1561.  
  1562.  
  1563. _________________________________________________________________
  1564.  
  1565. NAME
  1566.      history - Manipulate the history list
  1567.  
  1568. SYNOPSIS
  1569.      history ?option? ?arg arg ...?
  1570. _________________________________________________________________
  1571.  
  1572.  
  1573. DESCRIPTION
  1574.      The history  command  performs  one  of  several  operations
  1575.      related  to recently-executed commands recorded in a history
  1576.      list.  Each of these recorded commands is referred to as  an
  1577.      ``event''.  When specifying an event to the history command,
  1578.      the following forms may be used:
  1579.  
  1580.      [1]  A number:  if positive, it refers  to  the  event  with
  1581.           that  number  (all  events are numbered starting at 1).
  1582.           If the number is negative, it selects an event relative
  1583.           to  the current event (-1 refers to the previous event,
  1584.           -2 to the one before that, and so on).
  1585.  
  1586.      [2]  A string:  selects the most recent event  that  matches
  1587.           the string.  An event is considered to match the string
  1588.           either if the string is the same as the  first  charac-
  1589.           ters  of  the event, or if the string matches the event
  1590.           in the sense of the string match command.
  1591.  
  1592.      The history command can take any of the following forms:
  1593.  
  1594.      history
  1595.           Same as history info, described below.
  1596.  
  1597.      history add command ?exec?
  1598.           Adds the command argument to the history list as a  new
  1599.           event.   If exec is specified (or abbreviated) then the
  1600.           command is also executed and its  result  is  returned.
  1601.           If  exec  isn't  specified  then  an  empty  string  is
  1602.           returned as result.
  1603.  
  1604.      history change newValue ?event?
  1605.           Replaces the value recorded for an event with newValue.
  1606.           Event  specifies  the event to replace, and defaults to
  1607.           the current event (not  event  -1).   This  command  is
  1608.           intended  for  use in commands that implement new forms
  1609.           of history substitution and wish to replace the current
  1610.           event (which invokes the substitution) with the command
  1611.           created through substitution.  The return value  is  an
  1612.           empty string.
  1613.  
  1614.      history event ?event?
  1615.           Returns the value of the event given by  event.   Event
  1616.           defaults  to  -1.  This command causes history revision
  1617.           to occur: see below for details.
  1618.  
  1619.      history info ?count?
  1620.           Returns a formatted  string  (intended  for  humans  to
  1621.           read)  giving the event number and contents for each of
  1622.           the events in  the  history  list  except  the  current
  1623.           event.  If count is specified then only the most recent
  1624.           count events are returned.
  1625.  
  1626.      history keep count
  1627.           This command may be used to change the size of the his-
  1628.           tory  list  to  count events.  Initially, 20 events are
  1629.           retained in the history list.  This command returns  an
  1630.           empty string.
  1631.  
  1632.      history nextid
  1633.           Returns the number of the next event to be recorded  in
  1634.           the  history list.  It is useful for things like print-
  1635.           ing the event number in command-line prompts.
  1636.  
  1637.      history redo ?event?
  1638.           Re-executes the command indicated by event  and  return
  1639.           its  result.   Event  defaults  to  -1.   This  command
  1640.           results in history revision:  see below for details.
  1641.  
  1642.      history substitute old new ?event?
  1643.           Retrieves the command given by event (-1  by  default),
  1644.           replace  any  occurrences  of old by new in the command
  1645.           (only simple character equality is supported;  no  wild
  1646.           cards),  execute  the resulting command, and return the
  1647.           result of that execution.  This command results in his-
  1648.           tory revision:  see below for details.
  1649.  
  1650.      history words selector ?event?
  1651.           Retrieves from  the  command  given  by  event  (-1  by
  1652.           default)  the words given by selector, and return those
  1653.           words in a string separated by  spaces.   The  selector
  1654.           argument  has  three  forms.   If it is a single number
  1655.           then it selects the word given by that  number  (0  for
  1656.           the command name, 1 for its first argument, and so on).
  1657.           If it consists of two numbers separated by a dash, then
  1658.           it selects all the arguments between those two.  Other-
  1659.           wise selector is treated as a pattern; all words match-
  1660.           ing  that  pattern  (in  the sense of string match) are
  1661.           returned.  In the numeric forms $ may be used to select
  1662.           the  last  word of a command.  For example, suppose the
  1663.           most recent command in the history list is
  1664.  
  1665.                format  {%s is %d years old} Alice [expr $ageInMonths/12]
  1666.           Below are some history commands and  the  results  they
  1667.           would produce:
  1668.  
  1669.  
  1670.                history words $ [expr $ageInMonths/12]
  1671.                history words 1-2{%s is %d years  old} Alice
  1672.                history words *a*o*{%s is %d years old} [expr $ageInMonths/12]
  1673.           History words results in history revision:   see  below
  1674.           for details.
  1675.  
  1676. HISTORY REVISION
  1677.      The history  options  event,  redo,  substitute,  and  words
  1678.      result  in  ``history revision''.  When one of these options
  1679.      is invoked then the current event is modified  to  eliminate
  1680.      the  history  command  and replace it with the result of the
  1681.      history command.  For example, suppose that the most  recent
  1682.      command in the history list is
  1683.  
  1684.           set a [expr $b+2]
  1685.      and suppose that the next command invoked is one of the ones
  1686.      on  the  left side of the table below.  The command actually
  1687.      recorded in the history event will be the corresponding  one
  1688.      on the right side of the table.
  1689.  
  1690.  
  1691.           history redo    set a [expr $b+2]
  1692.           history s a b   set b [expr $b+2]
  1693.           set c [history w 2]set c [expr $b+2]
  1694.      History revision is needed because event specifiers like  -1
  1695.      are  only valid at a particular time:  once more events have
  1696.      been added to the history list a different  event  specifier
  1697.      would  be needed.  History revision occurs even when history
  1698.      is invoked indirectly from the current event  (e.g.  a  user
  1699.      types  a  command  that invokes a Tcl procedure that invokes
  1700.      history):  the top-level command whose execution  eventually
  1701.      resulted  in  a history command is replaced.  If you wish to
  1702.      invoke commands like history words without history revision,
  1703.      you  can use history event to save the current history event
  1704.      and then use history change to restore it later.
  1705.  
  1706.  
  1707. KEYWORDS
  1708.      event, history, record, revision
  1709.  
  1710.  
  1711. _________________________________________________________________
  1712.  
  1713. NAME
  1714.      if - Execute scripts conditionally
  1715.  
  1716. SYNOPSIS
  1717.      if expr1 ?then? body1 elseif expr2 ?then? body2  elseif  ...
  1718.      ?else? ?bodyN?
  1719. _________________________________________________________________
  1720.  
  1721.  
  1722. DESCRIPTION
  1723.      The if command evaluates expr1 as an expression (in the same
  1724.      way  that  expr  evaluates  its argument).  The value of the
  1725.      expression must be a boolean (a numeric value,  where  0  is  |
  1726.      false  and  anything is true, or a string value such as true  |
  1727.      or yes for true and false or no for false); if  it  is  true
  1728.      then body1 is executed by passing it to the Tcl interpreter.
  1729.      Otherwise expr2 is evaluated as an expression and if  it  is
  1730.      true  then  body2  is  executed,  and so on.  If none of the
  1731.      expressions evaluates to true then bodyN is  executed.   The
  1732.      then and else arguments are optional ``noise words'' to make
  1733.      the command easier to read.  There  may  be  any  number  of
  1734.      elseif  clauses,  including zero.  BodyN may also be omitted
  1735.      as long as else is omitted too.  The return value  from  the
  1736.      command  is the result of the body script that was executed,
  1737.      or an empty string if none of the expressions  was  non-zero
  1738.      and there was no bodyN.
  1739.  
  1740.  
  1741. KEYWORDS
  1742.      boolean, conditional, else, false, if, true
  1743.  
  1744.  
  1745. _________________________________________________________________
  1746.  
  1747. NAME
  1748.      incr - Increment the value of a variable
  1749.  
  1750. SYNOPSIS
  1751.      incr varName ?increment?
  1752. _________________________________________________________________
  1753.  
  1754.  
  1755. DESCRIPTION
  1756.      Increments the value stored in the variable  whose  name  is
  1757.      varName.   The value of the variable must be an integer.  If
  1758.      increment is supplied then  its  value  (which  must  be  an
  1759.      integer)  is added to the value of variable varName;  other-
  1760.      wise 1 is added to varName.  The new value is  stored  as  a
  1761.      decimal  string  in  variable  varName  and also returned as
  1762.      result.
  1763.  
  1764.  
  1765. KEYWORDS
  1766.      add, increment, variable, value
  1767.  
  1768.  
  1769. _________________________________________________________________
  1770.  
  1771. NAME
  1772.      info - Return information about the state of the Tcl  inter-
  1773.      preter
  1774.  
  1775. SYNOPSIS
  1776.      info option ?arg arg ...?
  1777. _________________________________________________________________
  1778.  
  1779.  
  1780. DESCRIPTION
  1781.      This command provides information about various internals of
  1782.      the  Tcl  interpreter.   The  legal  option's  (which may be
  1783.      abbreviated) are:
  1784.  
  1785.      info args procname
  1786.           Returns a list containing the names of the arguments to
  1787.           procedure  procname,  in  order.   Procname must be the
  1788.           name of a Tcl command procedure.
  1789.  
  1790.      info body procname
  1791.           Returns the body of procedure procname.  Procname  must
  1792.           be the name of a Tcl command procedure.
  1793.  
  1794.      info cmdcount
  1795.           Returns a count of the total number  of  commands  that
  1796.           have been invoked in this interpreter.
  1797.  
  1798.      info commands ?pattern?
  1799.           If pattern isn't specified, returns a list of names  of
  1800.           all  the Tcl commands, including both the built-in com-
  1801.           mands written in C and the command  procedures  defined
  1802.           using  the proc command.  If pattern is specified, only
  1803.           those names matching pattern are returned.  Matching is
  1804.           determined using the same rules as for string match.
  1805.  
  1806.      info complete command
  1807.           Returns 1 if command is a complete Tcl command  in  the
  1808.           sense of having no unclosed quotes, braces, brackets or
  1809.           array element names, If the command doesn't  appear  to
  1810.           be  complete then 0 is returned.  This command is typi-
  1811.           cally used in line-oriented input environments to allow
  1812.           users to type in commands that span multiple lines;  if
  1813.           the  command  isn't  complete,  the  script  can  delay
  1814.           evaluating it until additional lines have been typed to
  1815.           complete the command.
  1816.  
  1817.      info default procname arg varname
  1818.           Procname must be the name of a  Tcl  command  procedure
  1819.           and  arg  must  be the name of an argument to that pro-
  1820.           cedure.  If arg doesn't have a default value  then  the
  1821.           command  returns  0.  Otherwise it returns 1 and places
  1822.           the default value of arg into variable varname.
  1823.  
  1824.      info exists varName
  1825.           Returns 1 if the variable named varName exists  in  the
  1826.           current context (either as a global or local variable),
  1827.           returns 0 otherwise.
  1828.  
  1829.      info globals ?pattern?
  1830.           If pattern isn't specified, returns a list of  all  the
  1831.           names  of  currently-defined global variables.  If pat-
  1832.           tern is specified, only those  names  matching  pattern
  1833.           are  returned.   Matching  is determined using the same
  1834.           rules as for string match.
  1835.  
  1836.      info level ?number?
  1837.           If number is not  specified,  this  command  returns  a
  1838.           number  giving  the  stack  level  of the invoking pro-
  1839.           cedure, or 0 if the command is  invoked  at  top-level.
  1840.           If  number is specified, then the result is a list con-
  1841.           sisting of the name and  arguments  for  the  procedure
  1842.           call  at level number on the stack.  If number is posi-
  1843.           tive then it selects a particular stack level (1 refers
  1844.           to the top-most active procedure, 2 to the procedure it
  1845.           called, and so on); otherwise it gives a level relative
  1846.           to  the  current  level  (0  refers to the current pro-
  1847.           cedure, -1 to its caller, and so on).  See the  uplevel
  1848.           command for more information on what stack levels mean.
  1849.  
  1850.      info library
  1851.           Returns the name of  the  library  directory  in  which
  1852.           standard Tcl scripts are stored.  The default value for
  1853.           the library is compiled into Tcl, but it may  be  over-
  1854.           ridden by setting the TCL_LIBRARY environment variable.
  1855.           If there is no TCL_LIBRARY variable and no  compiled-in
  1856.           value  then  and  error  is generated.  See the library
  1857.           manual entry for details of the facilities provided  by
  1858.           the Tcl script library.  Normally each application will
  1859.           have its own  application-specific  script  library  in
  1860.           addition  to  the  Tcl  script library;  I suggest that
  1861.           each application set a global variable with a name like
  1862.           $app_library  (where  app is the application's name) to
  1863.           hold the location of that application's library  direc-
  1864.           tory.
  1865.  
  1866.      info locals ?pattern?
  1867.           If pattern isn't specified, returns a list of  all  the
  1868.           names  of  currently-defined local variables, including
  1869.           arguments to the current procedure, if any.   Variables
  1870.           defined  with the global and upvar commands will not be
  1871.           returned.  If pattern is specified,  only  those  names
  1872.           matching  pattern are returned.  Matching is determined
  1873.           using the same rules as for string match.
  1874.  
  1875.      info patchlevel
  1876.           Returns a decimal  integer  giving  the  current  patch  |
  1877.           level for Tcl.  The patch level is incremented for each  |
  1878.           new release or patch, and  it  uniquely  identifies  an  |
  1879.           official version of Tcl.
  1880.  
  1881.      info procs ?pattern?
  1882.           If pattern isn't specified, returns a list of  all  the
  1883.           names  of Tcl command procedures.  If pattern is speci-
  1884.           fied, only those names matching pattern  are  returned.
  1885.           Matching  is  determined  using  the  same rules as for
  1886.           string match.
  1887.  
  1888.      info script
  1889.           If a Tcl script file is currently being evaluated (i.e.
  1890.           there  is  a call to Tcl_EvalFile active or there is an
  1891.           active invocation of the  source  command),  then  this
  1892.           command  returns  the  name of the innermost file being
  1893.           processed.  Otherwise  the  command  returns  an  empty
  1894.           string.
  1895.  
  1896.      info tclversion
  1897.           Returns the version number for this version of  Tcl  in
  1898.           the  form  x.y,  where  changes  to  x  represent major
  1899.           changes with probable incompatibilities and changes  to
  1900.           y  represent  small  enhancements  and  bug  fixes that
  1901.           retain backward compatibility.
  1902.  
  1903.      info vars ?pattern?
  1904.           If pattern isn't specified, returns a list of  all  the
  1905.           names  of  currently-visible  variables, including both
  1906.           locals and currently-visible globals.   If  pattern  is
  1907.           specified,   only  those  names  matching  pattern  are
  1908.           returned.  Matching is determined using the same  rules
  1909.           as for string match.
  1910.  
  1911.  
  1912. KEYWORDS
  1913.      command, information, interpreter, level,  procedure,  vari-
  1914.      able
  1915.  
  1916.  
  1917. _________________________________________________________________
  1918.  
  1919. NAME
  1920.      join - Create a string by joining together list elements
  1921.  
  1922. SYNOPSIS
  1923.      join list ?joinString?
  1924. _________________________________________________________________
  1925.  
  1926.  
  1927. DESCRIPTION
  1928.      The list argument must be a valid Tcl  list.   This  command
  1929.      returns  the string formed by joining all of the elements of
  1930.      list together with joinString separating each adjacent  pair
  1931.      of  elements.   The  joinString argument defaults to a space
  1932.      character.
  1933.  
  1934.  
  1935. KEYWORDS
  1936.      element, join, list, separator
  1937.  
  1938.  
  1939. _________________________________________________________________
  1940.  
  1941. NAME
  1942.      lappend - Append list elements onto a variable
  1943.  
  1944. SYNOPSIS
  1945.      lappend varName value ?value value ...?
  1946. _________________________________________________________________
  1947.  
  1948.  
  1949. DESCRIPTION
  1950.      This command treats the variable given by varName as a  list
  1951.      and  appends  each  of the value arguments to that list as a
  1952.      separate element, with spaces between elements.  If  varName
  1953.      doesn't  exist,  it is created as a list with elements given
  1954.      by the value arguments.  Lappend is similar to append except
  1955.      that  the  values  are appended as list elements rather than
  1956.      raw text.  This command provides a relatively efficient  way
  1957.      to  build  up large lists.  For example, ``lappend a $b'' is
  1958.      much more efficient than ``set a  [concat  $a  [list  $b]]''
  1959.      when $a is long.
  1960.  
  1961.  
  1962. KEYWORDS
  1963.      append, element, list, variable
  1964.  
  1965.  
  1966. _________________________________________________________________
  1967.  
  1968. NAME
  1969.      library - standard library of Tcl procedures
  1970.  
  1971. SYNOPSIS
  1972.      auto_execok cmd
  1973.      auto_load cmd
  1974.      auto_mkindex dir pattern pattern ...
  1975.      auto_reset
  1976.      parray arrayName
  1977.      unknown cmd ?arg arg ...?
  1978. _________________________________________________________________
  1979.  
  1980.  
  1981. INTRODUCTION
  1982.      Tcl includes a library of Tcl procedures for commonly-needed
  1983.      functions.   The  procedures  defined in the Tcl library are
  1984.      generic ones suitable for use  by  many  different  applica-
  1985.      tions.   The  location of the Tcl library is returned by the
  1986.      info library command.  In addition to the Tcl library,  each
  1987.      application  will  normally  have its own library of support
  1988.      procedures as well;  the location of this  library  is  nor-
  1989.      mally  given  by  the value of the $app_library global vari-
  1990.      able, where app is the name of the application.   For  exam-
  1991.      ple,  the location of the Tk library is kept in the variable
  1992.      $tk_library.
  1993.  
  1994. #      To access the procedures in the Tcl library, an  application
  1995. #      should  source the file init.tcl in the library, for example
  1996. #      with the Tcl command
  1997. #           source [info library]/init.tcl
  1998. #      This will define the unknown procedure and arrange  for  the
  1999. #      other  procedures to be loaded on-demand using the auto-load
  2000. #      mechanism defined below.
  2001.  
  2002.  
  2003. COMMAND PROCEDURES
  2004.      The following procedures are provided in the Tcl library:
  2005.  
  2006.      auto_execok cmd
  2007.           Determines whether there is an executable file  by  the
  2008.           name cmd.  This command examines the directories in the
  2009.           current search path  (given  by  the  PATH  enviornment
  2010.           variable)  to  see if there is an executable file named
  2011.           cmd in any of those directories.  If so, it returns  1;
  2012.           if  not  it returns 0.  Auto_exec remembers information
  2013.           about previous searches in an array  named  auto_execs;
  2014.           this  avoids  the  path  search in future calls for the
  2015.           same cmd.  The command auto_reset may be used to  force
  2016.           auto_execok to forget its cached information.
  2017.  
  2018.      auto_load cmd
  2019.           This command attempts to load the definition for a  Tcl
  2020.           command  named  cmd.   To do this, it searches an auto-
  2021.           load path, which is a list of one or more  directories.
  2022.           The  auto-load  path  is  given  by the global variable
  2023.           $auto_path if it exists.  If  there  is  no  $auto_path
  2024.           variable,  then  the TCLLIBPATH environment variable is
  2025.           used, if it exists.  Otherwise the auto-load path  con-
  2026.           sists  of  just the Tcl library directory.  Within each
  2027.           directory in the auto-load path there must  be  a  file
  2028.           tclIndex that describes one or more commands defined in  |
  2029.           that directory and a script to evaluate to load each of  |
  2030.           the  commands.   The  tclIndex file should be generated  |
  2031.           with the auto_mkindex command.  If cmd is found  in  an  |
  2032.           index file, then the appropriate script is evaluated to  |
  2033.           create the command.  The auto_load command returns 1 if
  2034.           cmd was successfully created.  The command returns 0 if
  2035.           there was no index entry  for  cmd  or  if  the  script
  2036.           didn't actually define cmd (e.g. because index informa-
  2037.           tion is out of date).  If an error  occurs  while  pro-
  2038.           cessing  the  script,  then  that  error  is  returned.
  2039.           Auto_load only reads the  index  information  once  and
  2040.           saves  it  in  the  array  auto_index;  future calls to
  2041.           auto_load check for cmd in the array  rather  than  re-
  2042.           reading  the index files.  The cached index information
  2043.           may be deleted with the command auto_reset.  This  will
  2044.           force  the  next  auto_load command to reload the index
  2045.           database from disk.
  2046.  
  2047.      auto_mkindex dir pattern pattern ...
  2048.           Generates an index suitable for use by auto_load.   The  |
  2049.           command  searches  dir  for all files whose names match  |
  2050.           any of the pattern arguments (matching is done with the
  2051.           glob  command),  generates an index of all the Tcl com-
  2052.           mand procedures defined in all the matching files,  and
  2053.           stores  the  index information in a file named tclIndex
  2054.           in dir.  For example, the command
  2055.  
  2056.                auto_mkindex foo *.tcl
  2057.  
  2058.           will read all the .tcl files in  subdirectory  foo  and
  2059.           generate a new index file foo/tclIndex.
  2060.  
  2061.           Auto_mkindex parses the Tcl  scripts  in  a  relatively
  2062.           unsophisticated  way:   if  any  line contains the word
  2063.           proc as its first characters then it is assumed to be a
  2064.           procedure  definition  and the next word of the line is
  2065.           taken as the procedure's name.   Procedure  definitions
  2066.           that  don't  appear  in this way (e.g. they have spaces
  2067.           before the proc) will not be indexed.
  2068.  
  2069.      auto_reset
  2070.           Destroys all the information cached by auto_execok  and
  2071.           auto_load.   This information will be re-read from disk
  2072.           the next time it is needed.   Auto_reset  also  deletes
  2073.           any  procedures  listed in the auto-load index, so that
  2074.           fresh copies of them will be loaded the next time  that
  2075.           they're used.
  2076.  
  2077.      parray arrayName
  2078.           Prints on standard output the names and values  of  all
  2079.           the elements in the array arrayName.  ArrayName must be
  2080.           an array accessible to the caller of parray.  It may be
  2081.           either local or global.
  2082.  
  2083.      unknown cmd ?arg arg ...?
  2084.           This procedure is  invoked  automatically  by  the  Tcl
  2085.           interpreter  whenever  the  name  of  a command doesn't
  2086.           exist.  The unknown procedure receives as its arguments
  2087.           the name and arguments of the missing command.  Unknown  |
  2088.           first calls auto_load to load  the  command.   If  this
  2089.           succeeds,  then  it  executes the original command with
  2090.           its original arguments.  If the  auto-load  fails  then
  2091.           unknown calls auto_execok to see if there is an execut-
  2092.           able file by the name cmd.  If so, it invokes  the  Tcl
  2093.           exec  command  with  cmd and all the args as arguments.
  2094.           If cmd can't be auto-executed, unknown checks to see if
  2095.           the command was invoked at top-level and outside of any
  2096.           script.  If so, then unknown takes takes two additional
  2097.           steps.   First, it sees if cmd has one of the following
  2098.           three forms: !!, !event, or ^old^new?^?.  If  so,  then
  2099.           unknown  carries  out  history substitution in the same
  2100.           way that csh would for these constructs.   Second,  and
  2101.           last, unknown checks to see if cmd is a unique abbrevi-
  2102.           ation for an existing Tcl command.  If so,  it  expands
  2103.           the command name and executes the command with the ori-
  2104.           ginal arguments.  If none of the above efforts has been
  2105.           able to execute the command, unknown generates an error
  2106.           return.  If the global variable auto_noload is defined,
  2107.           then  the  auto-load  step  is  skipped.  If the global
  2108.           variable auto_noexec is defined then the auto-exec step
  2109.           is  skipped.   Under  normal  circumstances  the return
  2110.           value from unknown is the return value from the command
  2111.           that was eventually executed.
  2112.  
  2113.  
  2114. VARIABLES
  2115.      The following global variables are defined or  used  by  the
  2116.      procedures in the Tcl library:
  2117.  
  2118.      auto_execs
  2119.           Used by auto_execok to record information about whether
  2120.           particular commands exist as executable files.
  2121.  
  2122.      auto_index
  2123.           Used by auto_load to save the  index  information  read
  2124.           from disk.
  2125.  
  2126.      auto_noexec
  2127.           If set to any value, then unknown will not  attempt  to
  2128.           auto-exec any commands.
  2129.  
  2130.      auto_noload
  2131.           If set to any value, then unknown will not  attempt  to
  2132.           auto-load any commands.
  2133.  
  2134.      auto_path
  2135.           If set, then it must contain a valid  Tcl  list  giving
  2136.           directories to search during auto-load operations.
  2137.  
  2138.      env(TCL_LIBRARY)
  2139.           If set, then it specifies the location of the directory
  2140.           containing  library scripts (the value of this variable
  2141.           will be returned by the command info library).  If this
  2142.           variable isn't set then a default value is used.
  2143.  
  2144.      env(TCLLIBPATH)
  2145.           If set, then it must contain a valid  Tcl  list  giving
  2146.           directories  to  search  during  auto-load  operations.
  2147.           This variable is only used if auto_path is not defined.
  2148.  
  2149.      unknown_active
  2150.           This variable is set by unknown to indicate that it  is
  2151.           active.   It  is  used  to  detect errors where unknown
  2152.           recurses on itself infinitely.  The variable  is  unset
  2153.           before unknown returns.
  2154.  
  2155.  
  2156. KEYWORDS
  2157.      auto-exec, auto-load, library, unknown
  2158.  
  2159.  
  2160. _________________________________________________________________
  2161.  
  2162. NAME
  2163.      lindex - Retrieve an element from a list
  2164.  
  2165. SYNOPSIS
  2166.      lindex list index
  2167. _________________________________________________________________
  2168.  
  2169.  
  2170. DESCRIPTION
  2171.      This command treats list as  a  Tcl  list  and  returns  the
  2172.      index'th  element  from it (0 refers to the first element of
  2173.      the list).  In extracting the element, lindex  observes  the
  2174.      same  rules  concerning braces and quotes and backslashes as
  2175.      the Tcl command interpreter; however, variable  substitution
  2176.      and command substitution do not occur.  If index is negative
  2177.      or greater than or equal to the number of elements in value,
  2178.      then an empty string is returned.
  2179.  
  2180.  
  2181. KEYWORDS
  2182.      element, index, list
  2183.  
  2184.  
  2185. _________________________________________________________________
  2186.  
  2187. NAME
  2188.      linsert - Insert elements into a list
  2189.  
  2190. SYNOPSIS
  2191.      linsert list index element ?element element ...?
  2192. _________________________________________________________________
  2193.  
  2194.  
  2195. DESCRIPTION
  2196.      This command produces a new list from list by inserting  all
  2197.      of  the element arguments just before the indexth element of
  2198.      list.  Each element argument will become a separate  element
  2199.      of  the  new  list.  If index is less than or equal to zero,
  2200.      then the new elements are inserted at the beginning  of  the
  2201.      list.   If  index  is greater than or equal to the number of
  2202.      elements in the list, then the new elements are appended  to
  2203.      the list.
  2204.  
  2205.  
  2206. KEYWORDS
  2207.      element, insert, list
  2208.  
  2209.  
  2210. _________________________________________________________________
  2211.  
  2212. NAME
  2213.      list - Create a list
  2214.  
  2215. SYNOPSIS
  2216.      list ?arg arg ...?                                            |
  2217. _________________________________________________________________
  2218.  
  2219.  
  2220. DESCRIPTION
  2221.      This command returns a list comprised of all the args, or an  |
  2222.      empty   string   if  no  args  are  specified.   Braces  and
  2223.      backslashes get added as necessary, so that the  index  com-
  2224.      mand  may  be  used on the result to re-extract the original
  2225.      arguments, and also so that eval may be used to execute  the
  2226.      resulting  list, with arg1 comprising the command's name and
  2227.      the other args  comprising  its  arguments.   List  produces
  2228.      slightly  different results than concat:  concat removes one
  2229.      level of grouping before forming the list, while list  works
  2230.      directly from the original arguments.  For example, the com-
  2231.      mand
  2232.  
  2233.           list a b {c d e} {f {g h}}
  2234.      will return
  2235.  
  2236.           a b {c d e} {f {g h}}
  2237.      while concat with the same arguments will return
  2238.  
  2239.           a b c d e f {g h}
  2240.  
  2241.  
  2242. KEYWORDS
  2243.      element, list
  2244.  
  2245.  
  2246. _________________________________________________________________
  2247.  
  2248. NAME
  2249.      llength - Count the number of elements in a list
  2250.  
  2251. SYNOPSIS
  2252.      llength list
  2253. _________________________________________________________________
  2254.  
  2255.  
  2256. DESCRIPTION
  2257.      Treats list as a list and returns a  decimal  string  giving
  2258.      the number of elements in it.
  2259.  
  2260.  
  2261. KEYWORDS
  2262.      element, list, length
  2263.  
  2264.  
  2265. _________________________________________________________________
  2266.  
  2267. NAME
  2268.      lrange - Return one or more adjacent elements from a list
  2269.  
  2270. SYNOPSIS
  2271.      lrange list first last
  2272. _________________________________________________________________
  2273.  
  2274.  
  2275. DESCRIPTION
  2276.      List must be a valid Tcl list.  This command will  return  a
  2277.      new   list   consisting  of  elements  first  through  last,
  2278.      inclusive.  Last may be end (or any abbreviation of  it)  to
  2279.      refer  to  the  last  element of the list.  If first is less
  2280.      than zero, it is treated as if it were  zero.   If  last  is
  2281.      greater than or equal to the number of elements in the list,
  2282.      then it is treated as if it were end.  If first  is  greater
  2283.      than  last then an empty string is returned.  Note: ``lrange
  2284.      list first first'' does not always produce the  same  result
  2285.      as  ``lindex list first'' (although it often does for simple
  2286.      fields that aren't enclosed in braces);  it  does,  however,
  2287.      produce  exactly  the  same  results  as ``list [lindex list
  2288.      first]''
  2289.  
  2290.  
  2291. KEYWORDS
  2292.      element, list, range, sublist
  2293.  
  2294.  
  2295. _________________________________________________________________
  2296.  
  2297. NAME
  2298.      lreplace - Replace elements in a list with new elements
  2299.  
  2300. SYNOPSIS
  2301.      lreplace list first last ?element element ...?
  2302. _________________________________________________________________
  2303.  
  2304.  
  2305. DESCRIPTION
  2306.      Lreplace returns a new list formed by replacing one or  more
  2307.      elements  of  list  with the element arguments.  First gives
  2308.      the index in list of the first element to be  replaced.   If
  2309.      first  is less than zero then it refers to the first element
  2310.      of list;  the element indicated by first must exist  in  the
  2311.      list.   Last  gives the index in list of the last element to
  2312.      be replaced;  it must be greater than  or  equal  to  first.
  2313.      Last may be end (or any abbreviation of it) to indicate that
  2314.      all elements between first and the end of the list should be
  2315.      replaced.   The  element  arguments specify zero or more new
  2316.      arguments to be added to the list in  place  of  those  that
  2317.      were  deleted.  Each element argument will become a separate
  2318.      element of the list.  If no element arguments are specified,
  2319.      then the elements between first and last are simply deleted.
  2320.  
  2321.  
  2322. KEYWORDS
  2323.      element, list, replace
  2324.  
  2325.  
  2326. _________________________________________________________________
  2327.  
  2328. NAME
  2329.      lsearch - See if a list contains a particular element
  2330.  
  2331. SYNOPSIS
  2332.      lsearch ?mode? list pattern
  2333. _________________________________________________________________
  2334.  
  2335.  
  2336. DESCRIPTION
  2337.      This command searches the elements of list to see if one  of
  2338.      them  matches pattern.  If so, the command returns the index
  2339.      of the first matching element.  If not, the command  returns
  2340.      -1.   The  mode  argument  indicates how the elements of the  |
  2341.      list are to be matched against pattern and it must have  one  |
  2342.      of the following values:                                      |
  2343.  
  2344.      -exact                                                             ||
  2345.           The  list  element must contain exactly the same string  |
  2346.           as pattern.                                              |
  2347.  
  2348.      -glob                                                              ||
  2349.           Pattern  is  a  glob-style  pattern  which  is  matched  |
  2350.           against each list element using the same rules  as  the  |
  2351.           string match command.                                    |
  2352.  
  2353.      -regexp                                                            ||
  2354.           Pattern  is treated as a regular expression and matched  |
  2355.           against each list element using the same rules  as  the  |
  2356.           regexp command.                                          |
  2357.  
  2358.      If mode is omitted then it defaults to -glob.
  2359.  
  2360.  
  2361. KEYWORDS
  2362.      list, match, pattern, regular expression, search, string
  2363.  
  2364.  
  2365. _________________________________________________________________
  2366.  
  2367. NAME
  2368.      lsort - Sort the elements of a list
  2369.  
  2370. SYNOPSIS
  2371.      lsort ?switches? list
  2372. _________________________________________________________________
  2373.  
  2374.  
  2375. DESCRIPTION
  2376.      This command sorts the elements of  list,  returning  a  new
  2377.      list in sorted order.  By default ASCII sorting is used with
  2378.      the result returned in increasing order.   However,  any  of  |
  2379.      the  following switches may be specified before list to con-  |
  2380.      trol  the  sorting   process   (unique   abbreviations   are  |
  2381.      accepted):                                                    |
  2382.  
  2383.      -ascii                                                             ||
  2384.                          Use  string comparison with ASCII colla-  |
  2385.                          tion order.  This is the default.         |
  2386.  
  2387.      -ignore                                                             ||
  2388.                          ASCII comparison, ignore case.
  2389.  
  2390.      -integer                                                           ||
  2391.                          Convert  list  elements  to integers and  |
  2392.                          use integer comparison.                   |
  2393.  
  2394.      -real                                                              ||
  2395.                          Convert  list elements to floating-point  |
  2396.                          values and use floating comparison.       |
  2397.  
  2398.      -command command                                                   ||
  2399.                          Use command as a comparison command.  To  |
  2400.                          compare two  elements,  evaluate  a  Tcl  |
  2401.                          script  consisting  of  command with the  |
  2402.                          two  elements  appended  as   additional  |
  2403.                          arguments.   The script should return an  |
  2404.                          integer less than, equal to, or  greater  |
  2405.                          than  zero if the first element is to be  |
  2406.                          considered  less  than,  equal  to,   or  |
  2407.                          greater than the second, respectively.    |
  2408.  
  2409.      -increas-  |
  2410.                          ing                                                        ||
  2411.                          Sort  the  list  in   increasing   order  |
  2412.                          (``smallest'' items first).  This is the  |
  2413.                          default.                                  |
  2414.  
  2415.      -decreas-  |
  2416.                          ing                                                        ||
  2417.                          Sort  the  list  in   decreasing   order  |
  2418.                          (``largest'' items first).
  2419.  
  2420.  
  2421. KEYWORDS
  2422.      element, list, order, sort
  2423.  
  2424.  
  2425. _________________________________________________________________
  2426.  
  2427. NAME
  2428.      open - Open a file
  2429.  
  2430. SYNOPSIS
  2431.      open fileName ?access? ?permissions?                          |
  2432. _________________________________________________________________
  2433.  
  2434.  
  2435. DESCRIPTION
  2436.      This command opens a file and returns an identifier that may
  2437.      be  used  in future invocations of commands like read, puts,
  2438.      and close.  FileName gives the name of the file to open;  if
  2439.      it  starts with a tilde then tilde substitution is performed
  2440.      as described for Tcl_TildeSubst.  If the first character  of
  2441.      fileName  is ``|'' then the remaining characters of fileName
  2442.      are treated as a command pipeline to  invoke,  in  the  same
  2443.      style as for exec.  In this case, the identifier returned by
  2444.      open may be used to write to the  command's  input  pipe  or
  2445.      read from its output pipe.
  2446.  
  2447.      The access argument indicates the way in which the file  (or
  2448.      command pipeline) is to be accessed.  It may take two forms,  |
  2449.      either a string in the form that  would  be  passed  to  the  |
  2450.      fopen library procedure or a list of POSIX access flags.  It  |
  2451.      defaults to ``r''.  In the first form access may have any of  |
  2452.      the following values:
  2453.  
  2454.      r              Open the file for reading only; the file must
  2455.                     already exist.
  2456.  
  2457.      r+             Open the file for both reading  and  writing;
  2458.                     the file must already exist.
  2459.  
  2460.      w              Open the file for writing only.  Truncate  it
  2461.                     if  it exists.  If it doesn't exist, create a
  2462.                     new file.
  2463.  
  2464.      w+             Open the file for reading and writing.  Trun-
  2465.                     cate  it  if it exists.  If it doesn't exist,
  2466.                     create a new file.
  2467.  
  2468.      a              Open the file for  writing  only.   The  file
  2469.                     must  already  exist,  and  the file is posi-
  2470.                     tioned so that new data is  appended  to  the
  2471.                     file.
  2472.  
  2473.      a+             Open the file for reading  and  writing.   If
  2474.                     the  file  doesn't  exist, create a new empty
  2475.                     file.  Set the initial  access  position   to
  2476.                     the end of the file.
  2477.  
  2478.      In the second form, access consists of a list of any of  the  |
  2479.      following  flags, all of which have the standard POSIX mean-  |
  2480.      ings.  One of the flags must be  either  RDONLY,  WRONLY  or  |
  2481.      RDWR.                                                         |
  2482.  
  2483.      RDONLY                                                             ||
  2484.                     Open the file for reading only.                |
  2485.  
  2486.      WRONLY                                                             ||
  2487.                     Open the file for writing only.                |
  2488.  
  2489.      RDWR                                                               ||
  2490.                     Open the file for both reading and writing.    |
  2491.  
  2492.      APPEND                                                             ||
  2493.                     Set  the  file pointer to the end of the file  |
  2494.                     prior to each write.                           |
  2495.  
  2496.      CREAT                                                              ||
  2497.                     Create  the  file if it doesn't already exist  |
  2498.                     (without this flag it is  an  error  for  the  |
  2499.                     file not to exist).                            |
  2500.  
  2501.      EXCL                                                               ||
  2502.                     If  CREAT  is  specified  also,  an  error is  |
  2503.                     returned if the file already exists.           |
  2504.  
  2505.      NOCTTY                                                             ||
  2506.                     If  the  file is a terminal device, this flag  |
  2507.                     prevents the file from becoming the  control-  |
  2508.                     ling terminal of the process.                  |
  2509.  
  2510.      NON-  |
  2511.                     BLOCK                                                           ||
  2512.                     Prevents  the  process  from  blocking  while  |
  2513.                     opening  the file.  For details refer to your  |
  2514.                     system  documentation  on  the  open   system  |
  2515.                     call's O_NONBLOCK flag.                        |
  2516.  
  2517.      TRUNC                                                              ||
  2518.                     If  the  file  exists it is truncated to zero  |
  2519.                     length.                                        |
  2520.  
  2521.      If a new file is created as part of opening it,  permissions  |
  2522.      (an integer) is used to set the permissions for the new file  |
  2523.      in conjunction with the process's file mode  creation  mask.  |
  2524.      Permissions defaults to 0666.
  2525.  
  2526.      If a file is opened for both reading and writing  then  seek
  2527.      must  be  invoked  between a read and a write, or vice versa
  2528.      (this restriction does not apply to command pipelines opened
  2529.      with  open).  When fileName specifies a command pipeline and
  2530.      a write-only access is used, then standard output  from  the
  2531.      pipeline  is  directed to the current standard output unless
  2532.      overridden by the command.  When fileName specifies  a  com-
  2533.      mand  pipeline and a read-only access is used, then standard
  2534.      input from the pipeline is taken from the  current  standard
  2535.      input unless overridden by the command.
  2536.  
  2537.  
  2538. KEYWORDS
  2539.      access mode, append,  controlling  terminal,  create,  file,
  2540.      non-blocking, open, permissions, pipeline, process
  2541.  
  2542.  
  2543. _________________________________________________________________
  2544.  
  2545. NAME
  2546.      pid - Retrieve process id(s)
  2547.  
  2548. SYNOPSIS
  2549.      pid ?fileId?
  2550. _________________________________________________________________
  2551.  
  2552.  
  2553. DESCRIPTION
  2554.      If the fileId argument is  given  then  it  should  normally
  2555.      refer  to  a process pipeline created with the open command.
  2556.      In this case the pid command will return a list  whose  ele-
  2557.      ments  are  the  process identifiers of all the processes in
  2558.      the pipeline, in order.  The list will be  empty  if  fileId
  2559.      refers to an open file that isn't a process pipeline.  If no
  2560.      fileId argument is given then pid returns the process  iden-
  2561.      tifier  of the current process.  All process identifiers are
  2562.      returned as decimal strings.
  2563.  
  2564.  
  2565. KEYWORDS
  2566.      file, pipeline, process identifier
  2567.  
  2568.  
  2569. _________________________________________________________________
  2570.  
  2571. NAME
  2572.      proc - Create a Tcl procedure
  2573.  
  2574. SYNOPSIS
  2575.      proc name args body
  2576. _________________________________________________________________
  2577.  
  2578.  
  2579. DESCRIPTION
  2580.      The proc command creates a new  Tcl  procedure  named  name,
  2581.      replacing  any  existing command or procedure there may have
  2582.      been by that name.  Whenever the new command is invoked, the
  2583.      contents  of  body  will be executed by the Tcl interpreter.
  2584.      Args specifies the formal arguments to  the  procedure.   It
  2585.      consists  of  a list, possibly empty, each of whose elements
  2586.      specifies one argument.  Each argument specifier is  also  a
  2587.      list with either one or two fields.  If there is only a sin-
  2588.      gle field in the specifier then it is the name of the  argu-
  2589.      ment;  if  there are two fields, then the first is the argu-
  2590.      ment name and the second is its default value.
  2591.  
  2592.      When name is invoked a local variable will  be  created  for
  2593.      each  of  the  formal  arguments to the procedure; its value
  2594.      will be the value of corresponding argument in the  invoking
  2595.      command  or  the  argument's  default value.  Arguments with
  2596.      default values need not be specified in a procedure  invoca-
  2597.      tion.   However,  there  must be enough actual arguments for
  2598.      all the formal arguments that don't have defaults, and there
  2599.      must  not  be any extra actual arguments.  There is one spe-
  2600.      cial case to permit  procedures  with  variable  numbers  of
  2601.      arguments.   If  the last formal argument has the name args,
  2602.      then a call to the procedure may contain more  actual  argu-
  2603.      ments  than the procedure has formals.  In this case, all of
  2604.      the actual arguments starting  at  the  one  that  would  be
  2605.      assigned  to  args  are combined into a list (as if the list
  2606.      command had been used); this combined value is  assigned  to
  2607.      the local variable args.
  2608.  
  2609.      When body is being executed, variable names  normally  refer
  2610.      to  local  variables,  which  are created automatically when
  2611.      referenced and deleted  when  the  procedure  returns.   One
  2612.      local  variable  is  automatically  created  for each of the
  2613.      procedure's  arguments.   Global  variables  can   only   be
  2614.      accessed  by  invoking  the global command or the upvar com-
  2615.      mand.
  2616.  
  2617.      The proc command returns an empty string.  When a  procedure
  2618.      is invoked, the procedure's return value is the value speci-
  2619.      fied in a return command.  If the procedure doesn't  execute
  2620.      an  explicit  return,  then its return value is the value of
  2621.      the last command executed in the procedure's  body.   If  an
  2622.      error  occurs  while  executing the procedure body, then the
  2623.      procedure-as-a-whole will return that same error.
  2624.  
  2625.  
  2626. KEYWORDS
  2627.      argument, procedure
  2628.  
  2629.  
  2630. _________________________________________________________________
  2631.  
  2632. NAME
  2633.      puts - Write to a file
  2634.  
  2635. SYNOPSIS
  2636.      puts ?-nonewline? fileId string
  2637. _________________________________________________________________
  2638.  
  2639.  
  2640. DESCRIPTION
  2641.      Writes the characters given by string to the file  given  by
  2642.      fileId.   FileId must have been the return value from a pre-
  2643.      vious call to open; it must refer to a file that was opened
  2644.      for writing. Puts normally outputs a newline
  2645.      character after string, but this feature may  be  suppressed
  2646.      by  specifying  the  -nonewline  switch.  Output to files is
  2647.      buffered internally by Tcl; the flush command may be used to
  2648.      force buffered characters to be output.
  2649.  
  2650.      Note that <stdout> is not supported in Alpha!
  2651.  
  2652. KEYWORDS
  2653.      file, newline, output, write
  2654.  
  2655.  
  2656. _________________________________________________________________
  2657.  
  2658. NAME
  2659.      pwd - Return the current working directory
  2660.  
  2661. SYNOPSIS
  2662.      pwd
  2663. _________________________________________________________________
  2664.  
  2665.  
  2666. DESCRIPTION
  2667.      Returns the path name of the current working directory.
  2668.  
  2669.  
  2670. KEYWORDS
  2671.      working directory
  2672.  
  2673.  
  2674. _________________________________________________________________
  2675.  
  2676. NAME
  2677.      read - Read from a file
  2678.  
  2679. SYNOPSIS
  2680.      read ?-nonewline? fileId
  2681.      read fileId numBytes
  2682. _________________________________________________________________
  2683.  
  2684.  
  2685. DESCRIPTION
  2686.      In the first form, all of the remaining bytes are read  from
  2687.      the file given by fileId; they are returned as the result of
  2688.      the command.  If the -nonewline switch is specified then the
  2689.      last  character of the file is discarded if it is a newline.
  2690.      In the second form, the extra argument  specifies  how  many
  2691.      bytes  to  read;  exactly  this  many bytes will be read and
  2692.      returned, unless there are fewer than numBytes bytes left in
  2693.      the  file;  in  this  case,  all  the  remaining  bytes  are
  2694.      returned.  FileId must be stdin or the return value  from  a
  2695.      previous  call  to  open;  it  must refer to a file that was
  2696.      opened for reading.  Any existing end-of-file or error  con-  |
  2697.      dition  on  the file is cleared at the beginning of the read  |
  2698.      command.
  2699.  
  2700.  
  2701. KEYWORDS
  2702.      file, read
  2703.  
  2704.  
  2705. _________________________________________________________________
  2706.  
  2707. NAME
  2708.      regexp - Match a regular expression against a string
  2709.  
  2710. SYNOPSIS
  2711.      regexp ?switches? exp string  ?matchVar?  ?subMatchVar  sub-
  2712.      MatchVar ...?
  2713. _________________________________________________________________
  2714.  
  2715.  
  2716. DESCRIPTION
  2717.      Determines whether the regular expression exp  matches  part
  2718.      or all of string and returns 1 if it does, 0 if it doesn't.
  2719.  
  2720.      If additional arguments are specified after string then they
  2721.      are  treated  as  the  names of variables in which to return
  2722.      information about  which  part(s)  of  string  matched  exp.
  2723.      MatchVar will be set to the range of string that matched all
  2724.      of exp.  The first subMatchVar will contain  the  characters
  2725.      in string that matched the leftmost parenthesized subexpres-
  2726.      sion within exp, the next subMatchVar will contain the char-
  2727.      acters  that matched the next parenthesized subexpression to
  2728.      the right in exp, and so on.
  2729.  
  2730.      If the initial arguments to regexp start with  -  then  they  |
  2731.      are   treated  as  switches.   The  following  switches  are  |
  2732.      currently supported:                                          |
  2733.  
  2734.      -nocase                                                            ||
  2735.                Causes  upper-case  characters  in  string  to  be  |
  2736.                treated as lower case during the matching process.  |
  2737.  
  2738.      -indices                                                           ||
  2739.                Changes   what  is  stored  in  the  subMatchVars.  |
  2740.                Instead of storing the  matching  characters  from  |
  2741.                string,  each  variable will contain a list of two  |
  2742.                decimal strings giving the indices  in  string  of  |
  2743.                the  first  and  last  characters  in the matching  |
  2744.                range of characters.                                |
  2745.  
  2746.      --                                                                 ||
  2747.                Marks the end of switches.  The argument following  |
  2748.                this one will be treated as exp even if it  starts  |
  2749.                with a -.
  2750.  
  2751.      If there are more subMatchVar's  than  parenthesized  subex-
  2752.      pressions  within  exp,  or if a particular subexpression in
  2753.      exp doesn't match the string (e.g. because it was in a  por-
  2754.      tion  of  the  expression  that  wasn't  matched),  then the
  2755.      corresponding subMatchVar  will  be  set  to  ``-1  -1''  if
  2756.      -indices has been specified or to an empty string otherwise.
  2757.  
  2758. REGULAR EXPRESSIONS
  2759.      Regular expressions are implemented  using  Henry  Spencer's
  2760.      package  (thanks,  Henry!),  and  much of the description of
  2761.      regular expressions below is copied verbatim from his manual
  2762.      entry.
  2763.  
  2764.      A regular expression is zero or more branches, separated  by
  2765.      ``|''.    It  matches  anything  that  matches  one  of  the
  2766.      branches.
  2767.  
  2768.      A branch is zero or more pieces, concatenated.  It matches a
  2769.      match  for  the  first,  followed by a match for the second,
  2770.      etc.
  2771.  
  2772.      A piece is an atom possibly followed  by  ``*'',  ``+'',  or
  2773.      ``?''.  An atom followed by ``*'' matches a sequence of 0 or
  2774.      more matches of the atom.  An atom followed by ``+'' matches
  2775.      a  sequence  of 1 or more matches of the atom.  An atom fol-
  2776.      lowed by ``?'' matches a match of  the  atom,  or  the  null
  2777.      string.
  2778.  
  2779.      An atom is a regular expression in parentheses  (matching  a
  2780.      match  for  the  regular  expression),  a range (see below),
  2781.      ``.'' (matching any single character), ``^''  (matching  the
  2782.      null  string  at  the  beginning of the input string), ``$''
  2783.      (matching the null string at the end of the input string), a
  2784.      ``\''  followed by a single character (matching that charac-
  2785.      ter), or a  single  character  with  no  other  significance
  2786.      (matching that character).
  2787.  
  2788.      A range is a sequence of characters enclosed in ``[]''.   It
  2789.      normally matches any single character from the sequence.  If
  2790.      the sequence begins with ``^'', it matches any single  char-
  2791.      acter  not from the rest of the sequence.  If two characters
  2792.      in the sequence are separated by ``-'',  this  is  shorthand
  2793.      for  the  full  list  of ASCII characters between them (e.g.
  2794.      ``[0-9]'' matches any decimal digit).  To include a  literal
  2795.      ``]''  in the sequence, make it the first character (follow-
  2796.      ing a possible ``^'').  To include a literal ``-'', make  it
  2797.      the first or last character.
  2798.  
  2799.  
  2800. CHOOSING AMONG ALTERNATIVE MATCHES
  2801.      In general there may be more than one way to match a regular
  2802.      expression  to  an  input string.  For example, consider the
  2803.      command
  2804.  
  2805.           regexp  (a*)b*  aabaaabb  x  y
  2806.      Considering only the rules given so far, x and y  could  end
  2807.      up  with  the values aabb and aa, aaab and aaa, ab and a, or
  2808.      any of several other combinations.  To resolve  this  poten-
  2809.      tial  ambiguity  regexp chooses among alternatives using the
  2810.      rule ``first then longest''.  In other  words,  it  consders
  2811.      the  possible  matches  in  order working from left to right
  2812.      across the input string and the pattern, and it attempts  to
  2813.      match longer pieces of the input string before shorter ones.
  2814.      More specifically, the following rules apply  in  decreasing
  2815.      order of priority:
  2816.  
  2817.      [1]  If a regular expression could match two different parts
  2818.           of  an  input  string  then  it will match the one that
  2819.           begins earliest.
  2820.  
  2821.      [2]  If a regular expression contains | operators  then  the
  2822.           leftmost matching sub-expression is chosen.
  2823.  
  2824.      [3]  In *, +, and ? constructs, longer matches are chosen in
  2825.           preference to shorter ones.
  2826.  
  2827.      [4]  In sequences of expression  components  the  components
  2828.           are considered from left to right.
  2829.  
  2830.      In the example from above, (a*)b*  matches  aab:   the  (a*)
  2831.      portion  of the pattern is matched first and it consumes the
  2832.      leading aa; then the b* portion of the pattern consumes  the
  2833.      next b.  Or, consider the following example:
  2834.  
  2835.           regexp  (ab|a)(b*)c  abc  x  y  z
  2836.      After this command x will be abc, y will be ab, and  z  will
  2837.      be an empty string.  Rule 4 specifies that (ab|a) gets first
  2838.      shot at the input string and Rule 2 specifies  that  the  ab
  2839.      sub-expression is checked before the a sub-expression.  Thus
  2840.      the b has already been claimed before the (b*) component  is
  2841.      checked and (b*) must match an empty string.
  2842.  
  2843.  
  2844. KEYWORDS
  2845.      match, regular expression, string
  2846.  
  2847.  
  2848. _________________________________________________________________
  2849.  
  2850. NAME
  2851.      regsub - Perform substitutions based on  regular  expression
  2852.      pattern matching
  2853.  
  2854. SYNOPSIS
  2855.      regsub ?switches? exp string subSpec varName
  2856. _________________________________________________________________
  2857.  
  2858.  
  2859. DESCRIPTION
  2860.      This command matches  the  regular  expression  exp  against
  2861.      string,  and  it copies string to the variable whose name is  |
  2862.      given by varName.  The command returns 1 if there is a match  |
  2863.      and 0 if there isn't.  If there is a match, then while copy-  |
  2864.      ing string to varName the portion of string that matched exp
  2865.      is  replaced  with  subSpec.  If subSpec contains a ``&'' or
  2866.      ``\0'', then it is replaced in  the  substitution  with  the
  2867.      portion  of  string that matched exp.  If subSpec contains a
  2868.      ``\n'', where n is a digit between  1  and  9,  then  it  is
  2869.      replaced in the substitution with the portion of string that
  2870.      matched the n-th parenthesized subexpression of exp.   Addi-
  2871.      tional backslashes may be used in subSpec to prevent special
  2872.      interpretation of ``&'' or ``\0'' or  ``\n''  or  backslash.
  2873.      The  use  of  backslashes in subSpec tends to interact badly
  2874.      with the Tcl parser's use of backslashes, so it's  generally
  2875.      safest   to   enclose  subSpec  in  braces  if  it  includes
  2876.      backslashes.
  2877.  
  2878.      If the initial arguments to regexp start with  -  then  they  |
  2879.      are   treated  as  switches.   The  following  switches  are  |
  2880.      currently supported:                                          |
  2881.  
  2882.      -all                                                               ||
  2883.                All  ranges in string that match exp are found and  |
  2884.                substitution  is  performed  for  each  of   these  |
  2885.                ranges.  Without this switch only the first match-  |
  2886.                ing range is found and substituted.   If  -all  is  |
  2887.                specified,  then  ``&''  and  ``\n'' sequences are  |
  2888.                handled for each substitution using  the  informa-  |
  2889.                tion from the corresponding match.                  |
  2890.  
  2891.      -nocase                                                            ||
  2892.                Upper-case  characters in string will be converted  |
  2893.                to lower-case before matching against  exp;   how-  |
  2894.                ever,  substitutions  specified by subSpec use the  |
  2895.                original unconverted form of string.                |
  2896.  
  2897.      --                                                                 ||
  2898.                Marks the end of switches.  The argument following  |
  2899.                this one will be treated as exp even if it  starts  |
  2900.                with a -.
  2901.  
  2902.      See the manual entry for regexp for details on the interpre-
  2903.      tation of regular expressions.
  2904.  
  2905.  
  2906. KEYWORDS
  2907.      match, pattern, regular expression, substitute
  2908.  
  2909.  
  2910. _________________________________________________________________
  2911.  
  2912. NAME
  2913.      rename - Rename or delete a command
  2914.  
  2915. SYNOPSIS
  2916.      rename oldName newName
  2917. _________________________________________________________________
  2918.  
  2919.  
  2920. DESCRIPTION
  2921.      Rename the command that used to be called oldName so that it
  2922.      is  now  called newName.  If newName is an empty string then
  2923.      oldName is deleted.  The rename  command  returns  an  empty
  2924.      string as result.
  2925.  
  2926.  
  2927. KEYWORDS
  2928.      command, delete, rename
  2929.  
  2930.  
  2931. _________________________________________________________________
  2932.  
  2933. NAME
  2934.      return - Return from a procedure
  2935.  
  2936. SYNOPSIS
  2937.      return ?-code  code?  ?-errorinfo  info?  ?-errorcode  code?
  2938.      ?string?
  2939. _________________________________________________________________
  2940.  
  2941.  
  2942. DESCRIPTION
  2943.      Return immediately from the current procedure (or  top-level
  2944.      command or source command), with string as the return value.
  2945.      If string is not specified then  an  empty  string  will  be
  2946.      returned as result.
  2947.  
  2948.  
  2949. EXCEPTIONAL RETURNS
  2950.      In the usual case where the -code option isn't specified the  |
  2951.      procedure  will return normally (its completion code will be  |
  2952.      TCL_OK).  However, the -code option may be used to  generate  |
  2953.      an exceptional return from the procedure.  Code may have any  |
  2954.      of the following values:                                      |
  2955.  
  2956.      ok                                                                 ||
  2957.                Normal return:  same as if the option is omitted.   |
  2958.  
  2959.      error                                                              ||
  2960.                Error  return:  same  as if the error command were  |
  2961.                used to terminate the procedure, except  for  han-  |
  2962.                dling  of  errorInfo  and errorCode variables (see  |
  2963.                below).                                             |
  2964.  
  2965.      return                                                             ||
  2966.                The  current  procedure will return with a comple-  |
  2967.                tion code of TCL_RETURN,  so  that  the  procedure  |
  2968.                that invoked it will return also.                   |
  2969.  
  2970.      break                                                              ||
  2971.                The  current  procedure will return with a comple-  |
  2972.                tion code of TCL_BREAK, which will  terminate  the  |
  2973.                innermost nested loop in the code that invoked the  |
  2974.                current procedure.                                  |
  2975.  
  2976.      con-  |
  2977.                tinue                                                           ||
  2978.                The current procedure will return with  a  comple-  |
  2979.                tion  code  of  TCL_CONTINUE, which will terminate  |
  2980.                the current iteration of the innermost nested loop  |
  2981.                in the code that invoked the current procedure.     |
  2982.  
  2983.      value                                                              ||
  2984.                Value  must be an integer;  it will be returned as  |
  2985.                the completion code for the current procedure.      |
  2986.  
  2987.      The -code option is rarely used.  It  is  provided  so  that  |
  2988.      procedures that implement new control structures can reflect  |
  2989.      exceptional conditions back to their callers.                 |
  2990.  
  2991.      Two additional options, -errorinfo and  -errorcode,  may  be  |
  2992.      used to provide additional information during error returns.  |
  2993.      These options are ignored unless code is error.               |
  2994.  
  2995.      The -errorinfo option specifies an initial stack  trace  for  |
  2996.      the  errorInfo  variable;   if  it is not specified then the  |
  2997.      stack trace left in errorInfo will include the call  to  the  |
  2998.      procedure  and  higher  levels  on the stack but it will not  |
  2999.      include any information  about  the  context  of  the  error  |
  3000.      within  the procedure.  Typically the info value is supplied  |
  3001.      from the value left  in  errorInfo  after  a  catch  command  |
  3002.      trapped an error within the procedure.                        |
  3003.  
  3004.      If the -errorcode option is specified then code  provides  a  |
  3005.      value  for  the  errorCode  variable.   If the option is not  |
  3006.      specified then errorCode will default to NONE.
  3007.  
  3008.  
  3009. KEYWORDS
  3010.      break, continue, error, procedure, return
  3011.  
  3012.  
  3013. _________________________________________________________________
  3014.  
  3015. NAME
  3016.      scan - Parse string using conversion specifiers in the style
  3017.      of sscanf
  3018.  
  3019. SYNOPSIS
  3020.      scan string format varName ?varName ...?
  3021. _________________________________________________________________
  3022.  
  3023.  
  3024. INTRODUCTION
  3025.      This command parses fields from an input string in the  same
  3026.      fashion  as  the ANSI C sscanf procedure and returns a count
  3027.      of the number of fields sucessfully  parsed.   String  gives
  3028.      the input to be parsed and format indicates how to parse it,
  3029.      using % conversion specifiers as in  sscanf.   Each  varName
  3030.      gives  the  name of a variable; when a field is scanned from
  3031.      string the result  is  converted  back  into  a  string  and
  3032.      assigned to the corresponding variable.
  3033.  
  3034.  
  3035. DETAILS ON SCANNING
  3036.      Scan operates by scanning string and formatString  together.
  3037.      If the next character in formatString is a blank or tab then
  3038.      it is ignored.  Otherwise, if it isn't a % character then it
  3039.      must  match  the  next  non-white-space character of string.
  3040.      When a % is encountered in formatString,  it  indicates  the
  3041.      start  of  a  conversion  specifier.  A conversion specifier
  3042.      contains three fields after the %: a *, which indicates that
  3043.      the  converted  value is to be discarded instead of assigned
  3044.      to a variable; a number indicating a  maximum  field  width;
  3045.      and  a  conversion  character.   All  of  these  fields  are
  3046.      optional except for the conversion character.
  3047.  
  3048.      When scan finds a conversion specifier in  formatString,  it
  3049.      first  skips  any white-space characters in string.  Then it
  3050.      converts the next input characters according to the  conver-
  3051.      sion  specifier  and stores the result in the variable given
  3052.      by the next argument  to  scan.   The  following  conversion
  3053.      characters are supported:
  3054.  
  3055.      d         The input field must be a decimal integer.  It  is
  3056.                read in and the value is stored in the variable as
  3057.                a decimal string.
  3058.  
  3059.      o         The input field must be an octal  integer.  It  is
  3060.                read in and the value is stored in the variable as
  3061.                a decimal string.
  3062.  
  3063.      x         The input field must be a hexadecimal integer.  It
  3064.                is read in and the value is stored in the variable
  3065.                as a decimal string.
  3066.  
  3067.      c         A single character is read in and its binary value
  3068.                is  stored  in  the  variable as a decimal string.
  3069.                Initial white space is not skipped in  this  case,
  3070.                so the input field may be a white-space character.
  3071.                This conversion is different from the  ANSI  stan-
  3072.                dard  in that the input field always consists of a
  3073.                single character and no field width may be  speci-
  3074.                fied.
  3075.  
  3076.      s         The input field consists of all the characters  up
  3077.                to  the next white-space character; the characters
  3078.                are copied to the variable.
  3079.  
  3080.      e or f or g
  3081.                The input field must be  a  floating-point  number
  3082.                consisting  of  an  optional  sign,  a  string  of
  3083.                decimal digits  possibly  con  taining  a  decimal
  3084.                point, and an optional exponent consisting of an e
  3085.                or E followed by an optional sign and a string  of
  3086.                decimal  digits.   It is read in and stored in the
  3087.                variable as a floating-point string.
  3088.  
  3089.      [chars]   The input field consists of any number of  charac-
  3090.                ters  in  chars.  The matching string is stored in
  3091.                the variable.  If the first character between  the
  3092.                brackets  is  a  ]  then  it is treated as part of
  3093.                chars rather than the closing bracket for the set.
  3094.  
  3095.      [^chars]  The input field consists of any number of  charac-
  3096.                ters  not in chars.  The matching string is stored
  3097.                in the variable.   If  the  character  immediately
  3098.                following  the ^ is a ] then it is treated as part
  3099.                of the set rather than the closing bracket for the
  3100.                set.
  3101.  
  3102.      The number of characters read from the input for  a  conver-
  3103.      sion is the largest number that makes sense for that partic-
  3104.      ular conversion (e.g.  as many decimal  digits  as  possible
  3105.      for %d, as many octal digits as possible for %o, and so on).
  3106.      The input field for a  given  conversion  terminates  either
  3107.      when a white-space character is encountered or when the max-
  3108.      imum field width has been reached,  whichever  comes  first.
  3109.      If  a * is present in the conversion specifier then no vari-
  3110.      able is assigned and the next scan argument is not consumed.
  3111.  
  3112.  
  3113. DIFFERENCES FROM ANSI SSCANF
  3114.      The behavior of the scan command is the same as the behavior
  3115.      of  the  ANSI  C  sscanf  procedure except for the following
  3116.      differences:
  3117.  
  3118.      [1]  %p and %n conversion specifiers are not currently  sup-  |
  3119.           ported.
  3120.  
  3121.      [2]  For %c conversions a single  character  value  is  con-
  3122.           verted  to  a decimal string, which is then assigned to
  3123.           the corresponding varName; no field width may be speci-
  3124.           fied for this conversion.
  3125.  
  3126.      [3]  The l, h, and L modifiers are ignored;  integer  values  |
  3127.           are  always  converted  as  if  there  were no modifier  |
  3128.           present and real values are always converted as if  the  |
  3129.           l  modifier  were present (i.e. type double is used for  |
  3130.           the internal representation).
  3131.  
  3132.  
  3133. KEYWORDS
  3134.      conversion specifier, parse, scan
  3135.  
  3136.  
  3137. FILE SCANNING COMMANDS
  3138.      These commands provide a facility to  scan  files,  matching
  3139.      lines  of the file against regular expressions and executing
  3140.      Tcl code on a match.  With this facility you can use Tcl  to
  3141.      do  the  sort  of file processing that is traditionally done
  3142.      with awk.  And since Tcl's  approach  is  more  declarative,
  3143.      some of the scripts that can be rather difficult to write in
  3144.      awk are simple to code in Tcl.
  3145.  
  3146.      File scanning in Tcl centers around the concept  of  a  scan
  3147.      context.   A  scan context contains one or more match state-
  3148.      ments, which associate regular expressions to scan for  with
  3149.      Tcl code to be executed when the expressions are matched.
  3150.  
  3151.      scancontext ?option?
  3152.           This command manages file scan contexts.  A  scan  con-
  3153.           text  is  a  collection of regular expressions and com-
  3154.           mands to execute when that regular expression matches a
  3155.           line  of  the  file.   A context may also have a single
  3156.           default match, to be applied against lines that do  not
  3157.           match  any  of  the regular expressions.  Multiple scan
  3158.           contexts may be defined and they may be reused on  mul-
  3159.           tiple files.  A scan context is identified by a context
  3160.           handle.  The scancontext command  takes  the  following
  3161.           forms:
  3162.  
  3163.      scancontext create
  3164.           Create a new scan context.  The  scanmatch  command  is
  3165.           used  to define patterns in the context.  A contexthan-
  3166.           dle is returned, which the Tcl programmer uses to refer
  3167.           to  the  newly created scan context in calls to the Tcl
  3168.           file scanning commands.
  3169.  
  3170.      scancontext delete contexthandle
  3171.           Delete the scan context  identified  by  contexthandle,
  3172.           and free all of the match statements and compiled regu-
  3173.           lar expressions associated with the specified context.
  3174.  
  3175.      scanfile ?-copyfile copyFileId? contexthandle fileId
  3176.           Scan the file specified by fileId,  starting  from  the
  3177.           current  file position.  Check all patterns in the scan
  3178.           context specified by contexthandle against it,  execut-
  3179.           ing   the  match  commands  corresponding  to  patterns
  3180.           matched.
  3181.  
  3182.           If the optional -copyfile argument  is  specified,  the
  3183.           next  argument  is  a  file  ID  to which all lines not
  3184.           matched by any pattern (excluding the default  pattern)
  3185.           are to be written.
  3186.  
  3187.      scanmatch ?-nocase? contexthandle ?regexp? commands
  3188.           Specify Tcl commands, to be evaluated  when  regexp  is
  3189.           matched  by  a scanfile command.  The match is added to
  3190.           the  scan  context  specified  by  contexthandle.   Any
  3191.           number  of match statements may be specified for a give
  3192.           context.  Regexp  is  a  regular  expression  (see  the
  3193.           regexp  command).  If -nocase is specified as the first
  3194.           argument, the pattern is matched regardless  of  alpha-
  3195.           betic case.
  3196.  
  3197.           If regexp is not specified, then  a  default  match  is
  3198.           specified for the scan context.  The default match will
  3199.           be executed when a line of the file does not match  any
  3200.           of the regular expressions in the current scancontext.
  3201.  
  3202.           The array matchInfo is available to the Tcl  code  that
  3203.           is  executed  when an expression matches (or defaults).
  3204.           It contans information about the file being scanned and
  3205.           where within it the expression was matched.
  3206.  
  3207.           matchInfo is local to the top level of the  match  com-
  3208.           mand  unless  declared  global at that level by the Tcl
  3209.           global command.  If it is to be used as  a  global,  it
  3210.           must  be  declared  global  before  scanfile  is called
  3211.           (since scanfile sets the  matchInfo  before  the  match
  3212.           code is executed, a subsequent global will override the
  3213.           local  variable).   The  following  array  entries  are
  3214.           available:
  3215.  
  3216.           matchInfo(line)
  3217.                Contains the text of the line of the file that was
  3218.                matched.
  3219.  
  3220.           matchInfo(offset)
  3221.                The byte offset into the file of the first charac-
  3222.                ter of the line that was matched.
  3223.  
  3224.           matchInfo(linenum)
  3225.                The line number of the line that was matched. This
  3226.                is  relative  to  the first line scanned, which is
  3227.                usually, but not necessarily, the  first  line  of
  3228.                the file.  The first line is line number one.
  3229.  
  3230.           matchInfo(handle)
  3231.                The file id (handle) of the file  currently  being
  3232.                scanned.
  3233.  
  3234.           matchInfo(copyHandle)
  3235.                The file id (handle) of the file specified by  the
  3236.                -copyfile  option.   The element does not exist if
  3237.                -copyfile was not specified.
  3238.  
  3239.           matchInfo(submatch0)
  3240.                Will contain the  characters  matching  the  first
  3241.                parenthesized  subexpression.   The second will be
  3242.                contained in submatch1, etc.
  3243.  
  3244.           matchInfo(subindex0)
  3245.                Will contain the a list of the starting and ending
  3246.                indices   of   the   string   matching  the  first
  3247.                parenthesized subexpression.  The second  will  be
  3248.                contained in subindex1, etc.
  3249.  
  3250.      All scanmatch patterns that match a line will  be  processed
  3251.      in the order in which their specifications were added to the
  3252.      scan context.   The  remainder  of  the  scanmatch  pattern-
  3253.      command  pairs  may be skipped for a file line if a continue
  3254.      is executed by the Tcl code of a preceding, matched pattern.
  3255.  
  3256.      If a return is executed in the body of  the  match  command,
  3257.      the scanfile command currently in progress returns, with the
  3258.      value passed to return as its return value.
  3259.  
  3260.  
  3261. _________________________________________________________________
  3262.  
  3263. NAME
  3264.      seek - Change the access position for an open file
  3265.  
  3266. SYNOPSIS
  3267.      seek fileId offset ?origin?
  3268. _________________________________________________________________
  3269.  
  3270.  
  3271. DESCRIPTION
  3272.      Change the current access position for fileId.  FileId  must
  3273.      have  been the return value from a previous call to open, or
  3274.      it may be stdin, stdout, or stderr to refer to  one  of  the
  3275.      standard  I/O  channels.   The  offset  and origin arguments
  3276.      specify the position at which the next read  or  write  will
  3277.      occur  for  fileId.  Offset must be an integer (which may be
  3278.      negative) and origin must be one of the following:
  3279.  
  3280.      start
  3281.           The new access position will be offset bytes  from  the
  3282.           start of the file.
  3283.  
  3284.      current
  3285.           The new access position will be offset bytes  from  the
  3286.           current  access  position;  a negative offset moves the
  3287.           access position backwards in the file.
  3288.  
  3289.      end  The new access position will be offset bytes  from  the
  3290.           end  of  the file.  A negative offset places the access
  3291.           position before the end-of-file, and a positive  offset
  3292.           places the access position after the end-of-file.
  3293.  
  3294.      The origin argument defaults to start.  This command returns
  3295.      an empty string.
  3296.  
  3297.  
  3298. KEYWORDS
  3299.      access position, file, seek
  3300.  
  3301.  
  3302. _________________________________________________________________
  3303.  
  3304. NAME
  3305.      set - Read and write variables
  3306.  
  3307. SYNOPSIS
  3308.      set varName ?value?
  3309. _________________________________________________________________
  3310.  
  3311.  
  3312. DESCRIPTION
  3313.      Returns the value of variable varName.  If value  is  speci-
  3314.      fied, then set the value of varName to value, creating a new
  3315.      variable if one doesn't already exist, and return its value.
  3316.      If  varName  contains  an  open  parenthesis and ends with a
  3317.      close parenthesis, then it refers to an array element:   the
  3318.      characters before the first open parenthesis are the name of
  3319.      the array, and the characters between  the  parentheses  are
  3320.      the  index  within the array.  Otherwise varName refers to a
  3321.      scalar variable.  If no procedure is  active,  then  varName
  3322.      refers to a global variable.  If a procedure is active, then
  3323.      varName refers to a parameter or local variable of the  pro-
  3324.      cedure unless the global command has been invoked to declare
  3325.      varName to be global.
  3326.  
  3327.  
  3328. KEYWORDS
  3329.      read, write, variable
  3330.  
  3331.  
  3332. _________________________________________________________________
  3333.  
  3334. NAME
  3335.      source - Evaluate a file as a Tcl script
  3336.  
  3337. SYNOPSIS
  3338.      source fileName
  3339. _________________________________________________________________
  3340.  
  3341.  
  3342. DESCRIPTION
  3343.      Read file fileName and pass the contents to the  Tcl  inter-
  3344.      preter  as  a script to evaluate in the normal fashion.  The
  3345.      return value from source is the return  value  of  the  last
  3346.      command  executed  from  the  file.   If  an error occurs in
  3347.      evaluating the contents of the file then the source  command
  3348.      will return that error.  If a return command is invoked from
  3349.      within the file then the  remainder  of  the  file  will  be
  3350.      skipped and the source command will return normally with the
  3351.      result from the return command.  If fileName starts  with  a
  3352.      tilde,  then  it  is  tilde-substituted  as described in the
  3353.      Tcl_TildeSubst manual entry.
  3354.  
  3355.  
  3356. KEYWORDS
  3357.      file, script
  3358.  
  3359.  
  3360. _________________________________________________________________
  3361.  
  3362. NAME
  3363.      split - Split a string into a proper Tcl list
  3364.  
  3365. SYNOPSIS
  3366.      split string ?splitChars?
  3367. _________________________________________________________________
  3368.  
  3369.  
  3370. DESCRIPTION
  3371.      Returns a list created by splitting string at each character
  3372.      that  is  in  the  splitChars argument.  Each element of the
  3373.      result list will consist of the characters from string  that
  3374.      lie  between  instances  of  the  characters  in splitChars.
  3375.      Empty list elements will be  generated  if  string  contains
  3376.      adjacent  characters  in splitChars, or if the first or last
  3377.      character of string is in splitChars.  If splitChars  is  an
  3378.      empty  string  then  each  character  of  string  becomes  a
  3379.      separate element of the result list.  SplitChars defaults to
  3380.      the standard white-space characters.  For example,
  3381.  
  3382.           split "comp.unix.misc" .
  3383.      returns "comp unix misc" and
  3384.  
  3385.           split "Hello world" {}
  3386.      returns "H e l l o { } w o r l d".
  3387.  
  3388.  
  3389. KEYWORDS
  3390.      list, split, string
  3391.  
  3392.  
  3393. _________________________________________________________________
  3394.  
  3395. NAME
  3396.      string - Manipulate strings
  3397.  
  3398. SYNOPSIS
  3399.      string option arg ?arg ...?
  3400. _________________________________________________________________
  3401.  
  3402.  
  3403. DESCRIPTION
  3404.      Performs one of  several  string  operations,  depending  on
  3405.      option.  The legal options (which may be abbreviated) are:
  3406.  
  3407.      string compare string1 string2
  3408.           Perform a character-by-character comparison of  strings
  3409.           string1  and  string2  in  the same way as the C strcmp
  3410.           procedure.  Return -1, 0, or 1,  depending  on  whether
  3411.           string1  is  lexicographically  less than, equal to, or
  3412.           greater than string2.
  3413.  
  3414.      string first string1 string2
  3415.           Search  string2  for  a  sequence  of  characters  that
  3416.           exactly  match  the  characters  in string1.  If found,
  3417.           return the index of the first character  in  the  first
  3418.           such match within string2.  If not found, return -1.
  3419.  
  3420.      string index string charIndex
  3421.           Returns the charIndex'th character of the string  argu-
  3422.           ment.   A charIndex of 0 corresponds to the first char-
  3423.           acter of the string.  If charIndex is less  than  0  or
  3424.           greater  than or equal to the length of the string then
  3425.           an empty string is returned.
  3426.  
  3427.      string last string1 string2
  3428.           Search  string2  for  a  sequence  of  characters  that
  3429.           exactly  match  the  characters  in string1.  If found,
  3430.           return the index of the first  character  in  the  last
  3431.           such  match within string2.  If there is no match, then
  3432.           return -1.
  3433.  
  3434.      string length string
  3435.           Returns a decimal string giving the number  of  charac-
  3436.           ters in string.
  3437.  
  3438.      string match pattern string
  3439.           See if pattern matches string; return 1 if it  does,  0
  3440.           if  it  doesn't.  Matching is done in a fashion similar
  3441.           to that used by the C-shell.  For the  two  strings  to
  3442.           match, their contents must be identical except that the
  3443.           following special sequences may appear in pattern:
  3444.  
  3445.           *         Matches any sequence of characters in string,
  3446.                     including a null string.
  3447.  
  3448.           ?         Matches any single character in string.
  3449.  
  3450.           [chars]   Matches any character in  the  set  given  by
  3451.                     chars.  If a sequence of the form x-y appears
  3452.                     in chars, then any character between x and y,
  3453.                     inclusive, will match.
  3454.  
  3455.           \x        Matches the single character  x.   This  pro-
  3456.                     vides a way of avoiding the special interpre-
  3457.                     tation of the characters *?[]\ in pattern.
  3458.  
  3459.      string range string first last
  3460.           Returns a range of consecutive characters from  string,
  3461.           starting  with  the  character whose index is first and
  3462.           ending with the character  whose  index  is  last.   An
  3463.           index of 0 refers to the first character of the string.
  3464.           Last may be end (or any abbreviation of it) to refer to
  3465.           the  last  character  of  the string.  If first is less
  3466.           than zero then it is treated as if it were zero, and if
  3467.           last  is  greater  than  or  equal to the length of the
  3468.           string then it is treated as if it were end.  If  first
  3469.           is greater than last then an empty string is returned.
  3470.  
  3471.      string tolower string
  3472.           Returns a value equal to string except that  all  upper
  3473.           case letters have been converted to lower case.
  3474.  
  3475.      string toupper string
  3476.           Returns a value equal to string except that  all  lower
  3477.           case letters have been converted to upper case.
  3478.  
  3479.      string trim string ?chars?
  3480.           Returns a value equal to string except that any leading
  3481.           or  trailing characters from the set given by chars are
  3482.           removed.  If chars is not specified then white space is
  3483.           removed (spaces, tabs, newlines, and carriage returns).
  3484.  
  3485.      string trimleft string ?chars?
  3486.           Returns a value equal to string except that any leading
  3487.           characters from the set given by chars are removed.  If
  3488.           chars is not specified  then  white  space  is  removed
  3489.           (spaces, tabs, newlines, and carriage returns).
  3490.  
  3491.      string trimright string ?chars?
  3492.           Returns a value equal to string except that any  trail-
  3493.           ing characters from the set given by chars are removed.
  3494.           If chars is not specified then white space  is  removed
  3495.           (spaces, tabs, newlines, and carriage returns).
  3496.  
  3497.  
  3498. KEYWORDS
  3499.      case conversion, compare, index, match, pattern, string
  3500.  
  3501.  
  3502. _________________________________________________________________
  3503.  
  3504. NAME
  3505.      switch - Evaluate one of several  scripts,  depending  on  a
  3506.      given value
  3507.  
  3508. SYNOPSIS
  3509.      switch ?options? string pattern body ?pattern body ...?
  3510.      switch ?options? string {pattern body ?pattern body ...?}
  3511. _________________________________________________________________
  3512.  
  3513.  
  3514. DESCRIPTION
  3515.      The switch command matches its string argument against  each
  3516.      of  the  pattern  arguments in order.  As soon as it finds a
  3517.      pattern that matches string it evaluates the following  body
  3518.      argument  by  passing  it recursively to the Tcl interpreter
  3519.      and returns the result of that evaluation.  If the last pat-
  3520.      tern  argument  is  default then it matches anything.  If no
  3521.      pattern argument matches string and  no  default  is  given,
  3522.      then the switch command returns an empty string.
  3523.  
  3524.      If the initial arguments to switch start with  -  then  they
  3525.      are treated as options.  The following options are currently
  3526.      supported:
  3527.  
  3528.      -exact    Use exact matching when comparing string to a pat-
  3529.                tern.  This is the default.
  3530.  
  3531.      -glob     When matching string to the  patterns,  use  glob-
  3532.                style  matching  (i.e.  the same as implemented by
  3533.                the string match command).
  3534.  
  3535.      -regexp   When matching string to the patterns, use  regular
  3536.                expression  matching (i.e. the same as implemented
  3537.                by the regexp command).
  3538.  
  3539.      --        Marks the end of options.  The argument  following
  3540.                this  one  will  be  treated  as string even if it
  3541.                starts with a -.
  3542.  
  3543.      Two syntaxes are provided for the  pattern  and  body  argu-
  3544.      ments.   The  first uses a separate argument for each of the
  3545.      patterns and commands; this form is convenient if  substitu-
  3546.      tions  are desired on some of the patterns or commands.  The
  3547.      second form places all of the patterns and commands together
  3548.      into  a  single argument; the argument must have proper list
  3549.      structure, with the elements of the list being the  patterns
  3550.      and  commands.   The  second form makes it easy to construct
  3551.      multi-line switch commands,  since  the  braces  around  the
  3552.      whole list make it unnecessary to include a backslash at the
  3553.      end of each line.  Since the pattern arguments are in braces
  3554.      in the second form, no command or variable substitutions are
  3555.      performed on them;  this makes the behavior  of  the  second
  3556.      form different than the first form in some cases.
  3557.  
  3558.      If a body is specified as ``-'' it means that the  body  for
  3559.      the  next  pattern  should also be used as the body for this
  3560.      pattern (if the next pattern also has a body of  ``-''  then
  3561.      the body after that is used, and so on).  This feature makes
  3562.      it possible to share a single body among several patterns.
  3563.  
  3564.      Below are some examples of switch commands:
  3565.  
  3566.           switch abc a - b {format 1} abc {format 2} default {format 3}
  3567.      will return 2,
  3568.  
  3569.           switch -regexp aaab {
  3570.             ^a.*b$ -
  3571.             b {format 1}
  3572.             a* {format 2}
  3573.             default {format 3}
  3574.           }
  3575.      will return 1, and
  3576.  
  3577.           switch xyz {
  3578.             a
  3579.               -
  3580.             b
  3581.               {format 1}
  3582.             a*
  3583.               {format 2}
  3584.             default
  3585.               {format 3}
  3586.           }
  3587.      will return 3.
  3588.  
  3589.  
  3590. KEYWORDS
  3591.      switch, match, regular expression
  3592.  
  3593.  
  3594. _________________________________________________________________
  3595.  
  3596. NAME
  3597.      tclvars - Variables used by Tcl
  3598. _________________________________________________________________
  3599.  
  3600.  
  3601. DESCRIPTION
  3602.      The following  global  variables  are  created  and  managed
  3603.      automatically by the Tcl library.  Except where noted below,
  3604.      these variables should normally be treated as  read-only  by
  3605.      application-specific code and by users.
  3606.  
  3607.      env
  3608.           This variable is maintained by Tcl as  an  array  whose
  3609.           elements are the environment variables for the process.
  3610.           Reading  an  element  will  return  the  value  of  the
  3611.           corresponding environment variable.  Setting an element
  3612.           of the array will modify the corresponding  environment
  3613.           variable  or  create  a  new  one if it doesn't already
  3614.           exist.  Unsetting an element of  env  will  remove  the
  3615.           corresponding environment variable.  Changes to the env
  3616.           array will affect the environment passed to children by
  3617.           commands  like  exec.  If the entire env array is unset
  3618.           then Tcl will stop monitoring env accesses and will not
  3619.           update environment variables.
  3620.  
  3621.      errorCode
  3622.           After an error has occurred, this variable will be  set
  3623.           to  hold  additional  information  about the error in a
  3624.           form that is easy to process with programs.   errorCode
  3625.           consists  of a Tcl list with one or more elements.  The
  3626.           first element of the list identifies a general class of
  3627.           errors,  and  determines  the format of the rest of the
  3628.           list.  The following formats for errorCode are used  by
  3629.           the  Tcl core; individual applications may define addi-
  3630.           tional formats.
  3631.  
  3632.           ARITH code msg
  3633.                This format  is  used  when  an  arithmetic  error  |
  3634.                occurs  (e.g.  an attempt to divide by zero in the  |
  3635.                expr command).  Code identifies the precise  error  |
  3636.                and  msg  provides a human-readable description of  |
  3637.                the error.  Code will be either  DIVZERO  (for  an  |
  3638.                attempt to divide by zero), DOMAIN (if an argument  |
  3639.                is outside the  domain  of  a  function,  such  as  |
  3640.                acos(-3)),   IOVERFLOW   (for  integer  overflow),  |
  3641.                OVERLFLOW (for a floating-point overflow), or UNK-  |
  3642.                NOWN  (if  the cause of the error cannot be deter-  |
  3643.                mined).
  3644.  
  3645.           CHILDKILLED pid sigName msg
  3646.                This format is used when a child process has  been
  3647.                killed because of a signal.  The second element of
  3648.                errorCode will be  the  process's  identifier  (in
  3649.                decimal).   The third element will be the symbolic
  3650.                name of the signal that caused the process to ter-
  3651.                minate;  it  will  be  one  of  the names from the
  3652.                include  file  signal.h,  such  as  SIGPIPE.   The
  3653.                fourth element will be a short human-readable mes-
  3654.                sage describing the signal,  such  as  ``write  on
  3655.                pipe with no readers'' for SIGPIPE.
  3656.  
  3657.           CHILDSTATUS pid code
  3658.                This format is  used  when  a  child  process  has
  3659.                exited  with  a  non-zero exit status.  The second
  3660.                element of errorCode will be the  process's  iden-
  3661.                tifier  (in decimal) and the third element will be
  3662.                the exit code returned by  the  process  (also  in
  3663.                decimal).
  3664.  
  3665.           CHILDSUSP pid sigName msg
  3666.                This format is used when a child process has  been
  3667.                suspended because of a signal.  The second element
  3668.                of errorCode will be the process's identifier,  in
  3669.                decimal.   The  third element will be the symbolic
  3670.                name of the signal  that  caused  the  process  to
  3671.                suspend;  this  will  be one of the names from the
  3672.                include  file  signal.h,  such  as  SIGTTIN.   The
  3673.                fourth element will be a short human-readable mes-
  3674.                sage describing the signal, such  as  ``background
  3675.                tty read'' for SIGTTIN.
  3676.  
  3677.           NONE
  3678.                This format is used for errors where no additional
  3679.                information  is available for an error besides the
  3680.                message returned with the error.  In  these  cases
  3681.                errorCode will consist of a list containing a sin-
  3682.                gle element whose contents are NONE.
  3683.  
  3684.           POSIX errName msg
  3685.                If the first element of errorCode is  POSIX,  then  |
  3686.                the  error  occurred  during  a POSIX kernel call.
  3687.                The second element of the list  will  contain  the
  3688.                symbolic  name of the error that occurred, such as
  3689.                ENOENT; this will be one of the values defined  in
  3690.                the  include  file  errno.h.  The third element of
  3691.                the  list  will  be   a   human-readable   message
  3692.                corresponding  to  errName, such as ``no such file
  3693.                or directory'' for the ENOENT case.
  3694.  
  3695.           To set errorCode, applications should use library  pro-
  3696.           cedures such as Tcl_SetErrorCode and Tcl_PosixError, or  |
  3697.           they may invoke the error command.   If  one  of  these
  3698.           methods hasn't been used, then the Tcl interpreter will
  3699.           reset the variable to NONE after the next error.
  3700.  
  3701.      errorInfo
  3702.           After an error has occurred, this string  will  contain
  3703.           one or more lines identifying the Tcl commands and pro-
  3704.           cedures that were being executed when the  most  recent
  3705.           error  occurred.  Its contents take the form of a stack
  3706.           trace showing the various nested Tcl commands that  had
  3707.           been invoked at the time of the error.
  3708.  
  3709.      tcl_precision
  3710.           If this variable is set,  it  must  contain  a  decimal  |
  3711.           number  giving  the  number  of  significant  digits to  |
  3712.           include  when  converting  floating-point   values   to  |
  3713.           strings.  If this variable is not set then 6 digits are  |
  3714.           included.  17 digits is ``perfect'' for IEEE  floating-  |
  3715.           point  in  that it allows double-precision values to be  |
  3716.           converted to strings and back to binary with no loss of  |
  3717.           precision.
  3718.  
  3719.  
  3720. KEYWORDS
  3721.      arithmetic, error, environment,  POSIX,  precision,  subpro-
  3722.      cess, variables
  3723.  
  3724.  
  3725. _________________________________________________________________
  3726.  
  3727. NAME
  3728.      tell - Return current access position for an open file
  3729.  
  3730. SYNOPSIS
  3731.      tell fileId
  3732. _________________________________________________________________
  3733.  
  3734.  
  3735. DESCRIPTION
  3736.      Returns a decimal string giving the current access  position
  3737.      in  fileId.   FileId  must have been the return value from a
  3738.      previous call to open, or it may be stdin, stdout, or stderr
  3739.      to refer to one of the standard I/O channels.
  3740.  
  3741.  
  3742. KEYWORDS
  3743.      access position, file
  3744.  
  3745.  
  3746. _________________________________________________________________
  3747.  
  3748. NAME
  3749.      time - Time the execution of a script
  3750.  
  3751. SYNOPSIS
  3752.      time script ?count?
  3753. _________________________________________________________________
  3754.  
  3755.  
  3756. DESCRIPTION
  3757.      This command will call the Tcl interpreter  count  times  to
  3758.      evaluate script (or once if count isn't specified).  It will
  3759.      then return a string of the form
  3760.  
  3761.           503 microseconds per iteration
  3762.      which indicates the average  amount  of  time  required  per
  3763.      iteration,  in  microseconds.   Time  is measured in elapsed
  3764.      time, not CPU time.
  3765.  
  3766.  
  3767. KEYWORDS
  3768.      script, time
  3769.  
  3770.  
  3771. _________________________________________________________________
  3772.  
  3773. NAME
  3774.      trace - Monitor variable accesses
  3775.  
  3776. SYNOPSIS
  3777.      trace option ?arg arg ...?
  3778. _________________________________________________________________
  3779.  
  3780.  
  3781. DESCRIPTION
  3782.      This command causes Tcl commands  to  be  executed  whenever
  3783.      certain  operations  are invoked.  At present, only variable
  3784.      tracing is implemented. The legal  option's  (which  may  be
  3785.      abbreviated) are:
  3786.  
  3787.      trace variable name ops command
  3788.           Arrange for command to be  executed  whenever  variable
  3789.           name is accessed in one of the ways given by ops.  Name
  3790.           may refer to a normal variable, an element of an array,
  3791.           or  to  an  array as a whole (i.e. name may be just the
  3792.           name of an array, with  no  parenthesized  index).   If
  3793.           name  refers  to a whole array, then command is invoked
  3794.           whenever any element of the array is manipulated.
  3795.  
  3796.           Ops indicates which operations  are  of  interest,  and
  3797.           consists of one or more of the following letters:
  3798.  
  3799.                r    Invoke command whenever the variable is read.
  3800.  
  3801.                w    Invoke command whenever the variable is writ-
  3802.                     ten.
  3803.  
  3804.                u    Invoke  command  whenever  the  variable   is
  3805.                     unset.   Variables  can  be  unset explicitly
  3806.                     with the unset command,  or  implicitly  when
  3807.                     procedures  return  (all of their local vari-
  3808.                     ables are unset).  Variables are  also  unset
  3809.                     when  interpreters  are  deleted,  but traces
  3810.                     will not  be  invoked  because  there  is  no
  3811.                     interpreter in which to execute them.
  3812.  
  3813.           When the trace triggers, three arguments  are  appended
  3814.           to command so that the actual command is as follows:
  3815.  
  3816.                command name1 name2 op
  3817.           Name1 and name2 give the name(s) for the variable being
  3818.           accessed:  if the variable is a scalar then name1 gives
  3819.           the variable's name and name2 is an  empty  string;  if
  3820.           the  variable  is an array element then name1 gives the
  3821.           name of the array and name2 gives the  index  into  the
  3822.           array;  if  an  entire  array  is being deleted and the
  3823.           trace was registered on the overall array, rather  than
  3824.           a  single  element, then name1 gives the array name and
  3825.           name2 is an empty string.  Op indicates what  operation
  3826.           is being performed on the variable, and is one of r, w,
  3827.           or u as defined above.
  3828.  
  3829.           Command executes in the same context as the  code  that
  3830.           invoked  the  traced  operation:   if  the variable was
  3831.           accessed as part of a Tcl procedure, then command  will
  3832.           have  access to the same local variables as code in the
  3833.           procedure.  This context may be different than the con-
  3834.           text  in  which  the  trace  was  created.   If command
  3835.           invokes a procedure (which it normally does)  then  the
  3836.           procedure  will  have  to  use  upvar  or uplevel if it
  3837.           wishes to access the traced variable.  Note  also  that
  3838.           name1  may not necessarily be the same as the name used
  3839.           to set the trace  on  the  variable;   differences  can
  3840.           occur  if the access is made through a variable defined
  3841.           with the upvar command.
  3842.  
  3843.           For read and write traces, command can modify the vari-
  3844.           able  to affect the result of the traced operation.  If
  3845.           command modifies the value of a variable during a  read
  3846.           or  write trace, then the new value will be returned as
  3847.           the result of the traced operation.  The  return  value
  3848.           from   command  is ignored except that if it returns an
  3849.           error of  any  sort  then  the  traced  operation  also
  3850.           returns  an  error with the same error message returned  |
  3851.           by the trace command (this mechanism  can  be  used  to
  3852.           implement read-only variables, for example).  For write
  3853.           traces, command is invoked after the  variable's  value
  3854.           has  been  changed;  it  can write a new value into the
  3855.           variable to override the original  value  specified  in
  3856.           the write operation.  To implement read-only variables,
  3857.           command will have to restore the old value of the vari-
  3858.           able.
  3859.  
  3860.           While command is  executing  during  a  read  or  write
  3861.           trace, traces on the variable are temporarily disabled.
  3862.           This means that reads and  writes  invoked  by  command
  3863.           will  occur  directly, without invoking command (or any
  3864.           other traces) again.  However, if  command  unsets  the  |
  3865.           variable then unset traces will be invoked.
  3866.  
  3867.           When an  unset  trace  is  invoked,  the  variable  has
  3868.           already  been  deleted:  it will appear to be undefined
  3869.           with no traces.  If an unset occurs because of  a  pro-
  3870.           cedure  return,  then  the trace will be invoked in the
  3871.           variable context of the procedure  being  returned  to:
  3872.           the  stack  frame  of  the  returning procedure will no
  3873.           longer exist.  Traces are  not  disabled  during  unset
  3874.           traces,  so  if  an  unset  trace command creates a new
  3875.           trace and accesses the  variable,  the  trace  will  be
  3876.           invoked.  Any errors in unset traces are ignored.        |
  3877.  
  3878.           If there are multiple traces on  a  variable  they  are
  3879.           invoked  in  order  of creation, most-recent first.  If
  3880.           one trace returns an error, then no further traces  are
  3881.           invoked  for  the  variable.  If an array element has a
  3882.           trace set, and there is also a trace set on  the  array
  3883.           as  a  whole, the trace on the overall array is invoked
  3884.           before the one on the element.
  3885.  
  3886.           Once created, the trace remains in effect either  until
  3887.           the  trace  is  removed  with the trace vdelete command
  3888.           described below, until the variable is unset, or  until
  3889.           the  interpreter  is  deleted.  Unsetting an element of
  3890.           array will remove any traces on that element, but  will
  3891.           not remove traces on the overall array.
  3892.  
  3893.           This command returns an empty string.
  3894.  
  3895.      trace vdelete name ops command
  3896.           If there is a trace  set  on  variable  name  with  the
  3897.           operations  and  command given by ops and command, then
  3898.           the trace is removed, so that command will never  again
  3899.           be invoked.  Returns an empty string.
  3900.  
  3901.      trace vinfo name
  3902.           Returns a list containing one element  for  each  trace
  3903.           currently  set  on  variable name.  Each element of the
  3904.           list is itself a list containing  two  elements,  which
  3905.           are  the ops and command associated with the trace.  If
  3906.           name doesn't exist or doesn't have any traces set, then
  3907.           the result of the command will be an empty string.
  3908.  
  3909.  
  3910. KEYWORDS
  3911.      read, variable, write, trace, unset
  3912.  
  3913.  
  3914. _________________________________________________________________
  3915.  
  3916. NAME
  3917.      unknown - Handle attempts to use non-existent commands
  3918.  
  3919. SYNOPSIS
  3920.      unknown cmdName ?arg arg ...?
  3921. _________________________________________________________________
  3922.  
  3923.  
  3924. DESCRIPTION
  3925.      This command doesn't actually exist as part of Tcl, but  Tcl
  3926.      will  invoke  it  if  it does exist.  If the Tcl interpreter
  3927.      encounters a command name for which there is not  a  defined
  3928.      command,  then  Tcl  checks  for  the existence of a command
  3929.      named unknown.  If there is no such command, then the inter-
  3930.      preter  returns  an  error.   If the unknown command exists,
  3931.      then it is invoked with arguments consisting of  the  fully-
  3932.      substituted name and arguments for the original non-existent
  3933.      command.  The unknown command  typically  does  things  like
  3934.      searching  through  library  directories  for a command pro-
  3935.      cedure with the name cmdName, or expanding abbreviated  com-
  3936.      mand  names  to full-length, or automatically executing unk-
  3937.      nown commands as sub-processes.   In  some  cases  (such  as
  3938.      expanding  abbreviations)  unknown  will change the original
  3939.      command slightly and then (re-)execute it.   The  result  of
  3940.      the  unknown  command is used as the result for the original
  3941.      non-existent command.
  3942.  
  3943.  
  3944. KEYWORDS
  3945.      error, non-existent command
  3946.  
  3947.  
  3948. _________________________________________________________________
  3949.  
  3950. NAME
  3951.      unset - Delete variables
  3952.  
  3953. SYNOPSIS
  3954.      unset name ?name name ...?
  3955. _________________________________________________________________
  3956.  
  3957.  
  3958. DESCRIPTION
  3959.      This command removes one or more variables.  Each name is  a
  3960.      variable  name,  specified  in any of the ways acceptable to
  3961.      the set command.  If a name refers to an element of an array
  3962.      then  that  element is removed without affecting the rest of
  3963.      the array.  If a name consists of  an  array  name  with  no
  3964.      parenthesized  index, then the entire array is deleted.  The
  3965.      unset command returns an empty string as result.   An  error
  3966.      occurs  if any of the variables doesn't exist, and any vari-
  3967.      ables after the non-existent one are not deleted.
  3968.  
  3969.  
  3970. KEYWORDS
  3971.      remove, variable
  3972.  
  3973.  
  3974. _________________________________________________________________
  3975.  
  3976. NAME
  3977.      uplevel - Execute a script in a different stack frame
  3978.  
  3979. SYNOPSIS
  3980.      uplevel ?level? arg ?arg ...?
  3981. _________________________________________________________________
  3982.  
  3983.  
  3984. DESCRIPTION
  3985.      All of the arg arguments are concatenated  as  if  they  had
  3986.      been  passed  to concat; the result is then evaluated in the
  3987.      variable context indicated by level.   Uplevel  returns  the
  3988.      result of that evaluation.
  3989.  
  3990.      If level is an integer then it gives a distance (up the pro-
  3991.      cedure  calling stack) to move before executing the command.
  3992.      If level consists of # followed by a number then the  number
  3993.      gives an absolute level number.  If level is omitted then it
  3994.      defaults to 1.  Level cannot be defaulted if the first  com-
  3995.      mand argument starts with a digit or #.
  3996.  
  3997.      For example, suppose that procedure a was invoked from  top-
  3998.      level,  and  that it called b, and that b called c.  Suppose
  3999.      that c invokes the uplevel command.  If level is 1 or #2  or
  4000.      omitted,  then  the command will be executed in the variable
  4001.      context of b.  If level is 2 or #1 then the command will  be
  4002.      executed  in the variable context of a.  If level is 3 or #0
  4003.      then the command will be executed at top-level (only  global
  4004.      variables will be visible).
  4005.  
  4006.      The uplevel command causes the invoking procedure to  disap-
  4007.      pear  from  the procedure calling stack while the command is
  4008.      being executed.  In the above example, suppose c invokes the
  4009.      command
  4010.  
  4011.           uplevel 1 {set x 43; d}
  4012.      where d is another Tcl  procedure.   The  set  command  will
  4013.      modify  the variable x in b's context, and d will execute at
  4014.      level 3, as if called from b.  If it in  turn  executes  the
  4015.      command
  4016.  
  4017.           uplevel {set x 42}
  4018.      then the set command will modify the same variable x in  b's
  4019.      context:   the procedure c does not appear to be on the call
  4020.      stack when d is executing.  The command ``info  level''  may
  4021.      be used to obtain the level of the current procedure.
  4022.  
  4023.      Uplevel makes it possible  to  implement  new  control  con-
  4024.      structs  as  Tcl  procedures  (for example, uplevel could be
  4025.      used to implement the while construct as a Tcl procedure).
  4026.  
  4027.  
  4028. KEYWORDS
  4029.      context, stack frame, variables
  4030.  
  4031.  
  4032. _________________________________________________________________
  4033.  
  4034. NAME
  4035.      upvar - Create link to variable in a different stack frame
  4036.  
  4037. SYNOPSIS
  4038.      upvar ?level? otherVar myVar ?otherVar myVar ...?
  4039. _________________________________________________________________
  4040.  
  4041.  
  4042. DESCRIPTION
  4043.      This command arranges for one or more local variables in the
  4044.      current procedure to refer to variables in an enclosing pro-
  4045.      cedure call or to global variables.  Level may have  any  of
  4046.      the  forms  permitted  for  the  uplevel command, and may be
  4047.      omitted if the first letter of the first otherVar isn't # or
  4048.      a  digit  (it  defaults  to 1).  For each otherVar argument,
  4049.      upvar makes the variable by that name in the procedure frame
  4050.      given by level (or at global level, if level is #0) accessi-
  4051.      ble in the current  procedure  by  the  name  given  in  the
  4052.      corresponding  myVar argument.  The variable named by other-
  4053.      Var need not exist at the time of  the  call;   it  will  be
  4054.      created  the  first  time  myVar is referenced, just like an
  4055.      ordinary variable.  Upvar may only be  invoked  from  within
  4056.      procedures.   MyVar may not refer to an element of an array,  |
  4057.      but otherVar may refer to an array element.   Upvar  returns
  4058.      an empty string.
  4059.  
  4060.      The upvar command simplifies the implementation of  call-by-
  4061.      name procedure calling and also makes it easier to build new
  4062.      control constructs as Tcl procedures.  For example, consider
  4063.      the following procedure:
  4064.  
  4065.           proc add2 name {
  4066.               upvar $name x
  4067.               set x [expr $x+2]
  4068.           }
  4069.      Add2 is invoked with an argument giving the name of a  vari-
  4070.      able,  and  it  adds  two  to  the  value  of that variable.
  4071.      Although add2 could  have  been  implemented  using  uplevel
  4072.      instead  of upvar, upvar makes it simpler for add2 to access
  4073.      the variable in the caller's procedure frame.
  4074.  
  4075.      If an upvar variable is unset (e.g. x in  add2  above),  the  |
  4076.      unset  operation  affects  the variable it is linked to, not  |
  4077.      the upvar variable.  There is no way to unset an upvar vari-  |
  4078.      able except by exiting the procedure in which it is defined.  |
  4079.      However, it is possible to retarget  an  upvar  variable  by  |
  4080.      executing another upvar command.
  4081.  
  4082.  
  4083. KEYWORDS
  4084.      context, frame, global, level, procedure, variable
  4085.  
  4086.  
  4087. _________________________________________________________________
  4088.  
  4089. NAME
  4090.      while - Execute script repeatedly as long as a condition  is
  4091.      met
  4092.  
  4093. SYNOPSIS
  4094.      while test body
  4095. _________________________________________________________________
  4096.  
  4097.  
  4098. DESCRIPTION
  4099.      The while command evaluates test as an  expression  (in  the
  4100.      same  way  that  expr evaluates its argument).  The value of
  4101.      the expression must a proper boolean value; if it is a  true
  4102.      value  then body is executed by passing it to the Tcl inter-
  4103.      preter.  Once body has been executed then test is  evaluated
  4104.      again,  and the process repeats until eventually test evalu-
  4105.      ates to a false boolean value.   Continue  commands  may  be
  4106.      executed  inside  body to terminate the current iteration of
  4107.      the loop, and break commands may be executed inside body  to
  4108.      cause immediate termination of the while command.  The while
  4109.      command always returns an empty string.
  4110.  
  4111.  
  4112. KEYWORDS
  4113.      boolean value, loop, test, while
  4114.  
  4115.  
  4116.